hgext/mq.py
changeset 2791 4c39568007f9
parent 2790 e5e23cae6e09
child 2792 a3c6e7888abf
equal deleted inserted replaced
2790:e5e23cae6e09 2791:4c39568007f9
   302                     self.ui.warn(file_str + '\n')
   302                     self.ui.warn(file_str + '\n')
   303                     printed_file = True
   303                     printed_file = True
   304                 self.ui.warn(l + '\n')
   304                 self.ui.warn(l + '\n')
   305 
   305 
   306         return (not f.close(), files, fuzz)
   306         return (not f.close(), files, fuzz)
   307         
   307 
   308     def apply(self, repo, series, list=False, update_status=True,
   308     def apply(self, repo, series, list=False, update_status=True,
   309               strict=False, patchdir=None, merge=None, wlock=None):
   309               strict=False, patchdir=None, merge=None, wlock=None):
   310         # TODO unify with commands.py
   310         # TODO unify with commands.py
   311         if not patchdir:
   311         if not patchdir:
   312             patchdir = self.path
   312             patchdir = self.path
  1283 
  1283 
  1284     -m or -l set the patch header as well as the commit message.
  1284     -m or -l set the patch header as well as the commit message.
  1285     If neither is specified, the patch header is empty and the
  1285     If neither is specified, the patch header is empty and the
  1286     commit message is 'New patch: PATCH'"""
  1286     commit message is 'New patch: PATCH'"""
  1287     q = repo.mq
  1287     q = repo.mq
  1288     message=commands.logmessage(**opts)
  1288     message = commands.logmessage(**opts)
  1289     q.new(repo, patch, msg=message, force=opts['force'])
  1289     q.new(repo, patch, msg=message, force=opts['force'])
  1290     q.save_dirty()
  1290     q.save_dirty()
  1291     return 0
  1291     return 0
  1292 
  1292 
  1293 def refresh(ui, repo, **opts):
  1293 def refresh(ui, repo, **opts):
  1294     """update the current patch"""
  1294     """update the current patch"""
  1295     q = repo.mq
  1295     q = repo.mq
  1296     message=commands.logmessage(**opts)
  1296     message = commands.logmessage(**opts)
  1297     if opts['edit']:
  1297     if opts['edit']:
  1298         if message:
  1298         if message:
  1299             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
  1299             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
  1300         patch = q.applied[-1].name
  1300         patch = q.applied[-1].name
  1301         (message, comment, user, date, hasdiff) = q.readheaders(patch)
  1301         (message, comment, user, date, hasdiff) = q.readheaders(patch)
  1328     if not files:
  1328     if not files:
  1329         raise util.Abort(_('qfold requires at least one patch name'))
  1329         raise util.Abort(_('qfold requires at least one patch name'))
  1330     if not q.check_toppatch(repo):
  1330     if not q.check_toppatch(repo):
  1331         raise util.Abort(_('No patches applied\n'))
  1331         raise util.Abort(_('No patches applied\n'))
  1332 
  1332 
  1333     message=commands.logmessage(**opts)
  1333     message = commands.logmessage(**opts)
  1334     if opts['edit']:
  1334     if opts['edit']:
  1335         if message:
  1335         if message:
  1336             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
  1336             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
  1337 
  1337 
  1338     parent = q.lookup('qtip')
  1338     parent = q.lookup('qtip')
  1505     return 0
  1505     return 0
  1506 
  1506 
  1507 def save(ui, repo, **opts):
  1507 def save(ui, repo, **opts):
  1508     """save current queue state"""
  1508     """save current queue state"""
  1509     q = repo.mq
  1509     q = repo.mq
  1510     message=commands.logmessage(**opts)
  1510     message = commands.logmessage(**opts)
  1511     ret = q.save(repo, msg=message)
  1511     ret = q.save(repo, msg=message)
  1512     if ret:
  1512     if ret:
  1513         return ret
  1513         return ret
  1514     q.save_dirty()
  1514     q.save_dirty()
  1515     if opts['copy']:
  1515     if opts['copy']: