hgext/mq.py
changeset 2754 19041b8cbc86
parent 2753 84218111e80f
child 2756 caa6d992608b
equal deleted inserted replaced
2753:84218111e80f 2754:19041b8cbc86
  1182               existing=opts['existing'], force=opts['force'])
  1182               existing=opts['existing'], force=opts['force'])
  1183     q.save_dirty()
  1183     q.save_dirty()
  1184     return 0
  1184     return 0
  1185 
  1185 
  1186 def init(ui, repo, **opts):
  1186 def init(ui, repo, **opts):
  1187     """init a new queue repository"""
  1187     """init a new queue repository
       
  1188 
       
  1189     The queue repository is unversioned by default. If -c is
       
  1190     specified, qinit will create a separate nested repository
       
  1191     for patches. Use qcommit to commit changes to this queue
       
  1192     repository."""
  1188     q = repo.mq
  1193     q = repo.mq
  1189     r = q.init(repo, create=opts['create_repo'])
  1194     r = q.init(repo, create=opts['create_repo'])
  1190     q.save_dirty()
  1195     q.save_dirty()
  1191     if r:
  1196     if r:
  1192         fp = r.wopener('.hgignore', 'w')
  1197         fp = r.wopener('.hgignore', 'w')
  1267     """print the name of the previous patch"""
  1272     """print the name of the previous patch"""
  1268     repo.mq.prev(repo)
  1273     repo.mq.prev(repo)
  1269     return 0
  1274     return 0
  1270 
  1275 
  1271 def new(ui, repo, patch, **opts):
  1276 def new(ui, repo, patch, **opts):
  1272     """create a new patch"""
  1277     """create a new patch
       
  1278 
       
  1279     qnew creates a new patch on top of the currently-applied patch
       
  1280     (if any). It will refuse to run if there are any outstanding
       
  1281     changes unless -f is specified, in which case the patch will
       
  1282     be initialised with them.
       
  1283 
       
  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
       
  1286     commit message is 'New patch: PATCH'
       
  1287 
       
  1288     If -f is specified, the patch will be initialized with any
       
  1289     uncommitted changes. Otherwise, if there outsta"""
  1273     q = repo.mq
  1290     q = repo.mq
  1274     message=commands.logmessage(**opts)
  1291     message=commands.logmessage(**opts)
  1275     q.new(repo, patch, msg=message, force=opts['force'])
  1292     q.new(repo, patch, msg=message, force=opts['force'])
  1276     q.save_dirty()
  1293     q.save_dirty()
  1277     return 0
  1294     return 0
  1474         backup = 'none'
  1491         backup = 'none'
  1475     repo.mq.strip(repo, rev, backup=backup)
  1492     repo.mq.strip(repo, rev, backup=backup)
  1476     return 0
  1493     return 0
  1477 
  1494 
  1478 def version(ui, q=None):
  1495 def version(ui, q=None):
  1479     """print the version number"""
  1496     """print the version number of the mq extension"""
  1480     ui.write("mq version %s\n" % versionstr)
  1497     ui.write("mq version %s\n" % versionstr)
  1481     return 0
  1498     return 0
  1482 
  1499 
  1483 def reposetup(ui, repo):
  1500 def reposetup(ui, repo):
  1484     class MqRepo(repo.__class__):
  1501     class MqRepo(repo.__class__):
  1544          'hg qinit [-c]'),
  1561          'hg qinit [-c]'),
  1545     "qnew":
  1562     "qnew":
  1546         (new,
  1563         (new,
  1547          [('m', 'message', '', _('use <text> as commit message')),
  1564          [('m', 'message', '', _('use <text> as commit message')),
  1548           ('l', 'logfile', '', _('read the commit message from <file>')),
  1565           ('l', 'logfile', '', _('read the commit message from <file>')),
  1549           ('f', 'force', None, 'force')],
  1566           ('f', 'force', None, _('import uncommitted changes into patch'))],
  1550          'hg qnew [-m TEXT] [-l FILE] [-f] PATCH'),
  1567          'hg qnew [-m TEXT] [-l FILE] [-f] PATCH'),
  1551     "qnext": (next, [], 'hg qnext'),
  1568     "qnext": (next, [], 'hg qnext'),
  1552     "qprev": (prev, [], 'hg qprev'),
  1569     "qprev": (prev, [], 'hg qprev'),
  1553     "^qpop":
  1570     "^qpop":
  1554         (pop,
  1571         (pop,