changeset 8362:bbc74c05b8a4

mq: add -P/--push option to qimport
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Tue, 12 May 2009 11:15:54 +0200
parents d8c5a7f25a40
children c8e81f557da7
files hgext/mq.py tests/test-mq-qimport tests/test-mq-qimport.out
diffstat 3 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue May 12 12:05:19 2009 +0200
+++ b/hgext/mq.py	Tue May 12 11:15:54 2009 +0200
@@ -1693,6 +1693,9 @@
               existing=opts['existing'], force=opts['force'], rev=opts['rev'],
               git=opts['git'])
     q.save_dirty()
+
+    if opts.get('push') and not opts.get('rev'):
+        return q.push(repo, None)
     return 0
 
 def init(ui, repo, **opts):
@@ -2522,8 +2525,9 @@
           ('n', 'name', '', _('patch file name')),
           ('f', 'force', None, _('overwrite existing files')),
           ('r', 'rev', [], _('place existing revisions under mq control')),
-          ('g', 'git', None, _('use git extended diff format'))],
-         _('hg qimport [-e] [-n NAME] [-f] [-g] [-r REV]... FILE...')),
+          ('g', 'git', None, _('use git extended diff format')),
+          ('P', 'push', None, _('qpush after importing'))],
+         _('hg qimport [-e] [-n NAME] [-f] [-g] [-P] [-r REV]... FILE...')),
     "^qinit":
         (init,
          [('c', 'create-repo', None, _('create queue repository'))],
--- a/tests/test-mq-qimport	Tue May 12 12:05:19 2009 +0200
+++ b/tests/test-mq-qimport	Tue May 12 11:15:54 2009 +0200
@@ -69,4 +69,10 @@
 hg qimport b.diff
 hg qpush
 
-
+echo % try to import --push
+echo another >> b
+hg diff > another.diff
+hg up -C
+hg qimport --push another.diff
+hg qfin -a
+hg qimport -rtip -P
--- a/tests/test-mq-qimport.out	Tue May 12 12:05:19 2009 +0200
+++ b/tests/test-mq-qimport.out	Tue May 12 11:15:54 2009 +0200
@@ -22,3 +22,8 @@
 adding b.diff to series file
 applying b.diff
 now at: b.diff
+% try to import --push
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding another.diff to series file
+applying another.diff
+now at: another.diff