Commits

Richard Murri  committed 73e7848

add qimport -t option to import task

  • Participants
  • Parent commits 7bb048c

Comments (0)

Files changed (1)

File hgext/tasks.py

                 _('email all changesets in task TASK')))
     except:
         pass
+    try:
+        mq = extensions.find('mq')
+        if mq:
+            entry = extensions.wrapcommand(mq.cmdtable, 'qimport',
+                tasksqimport)
+            entry[1].append(('t', 'task', '',
+                _('import all changesets in task TASK')))
+    except:
+        pass
+
+def tasksqimport(orig, ui, repo, *revs, **opts):
+    if opts['task']:
+        if revs or opts['rev']:
+            raise util.Abort(_('cannot specify rev and task'))
+        tasks = parse(repo)
+
+        if opts['task'] not in tasks:
+            raise util.Abort(_('invalid task name'))
+
+        if tasks[opts['task']]['state'] == 0:
+            raise util.Abort(_('task has no changesets'))
+
+        tnodes = tasknodes(repo, tasks[opts['task']])
+        opts['rev'] = ['%d' % repo.changelog.rev(node) for node in tnodes]
+
+    return orig(ui, repo, *revs, **opts)
 
 def tasksemail(orig, ui, repo, *revs, **opts):
     if opts['task']: