##// END OF EJS Templates
mq: make qimport --push push all imported patches (issue3130)...
Patrick Mezard -
r16119:5de83d9c stable
parent child Browse files
Show More
@@ -1795,6 +1795,7 b' class queue(object):'
1795 if (len(files) > 1 or len(rev) > 1) and patchname:
1795 if (len(files) > 1 or len(rev) > 1) and patchname:
1796 raise util.Abort(_('option "-n" not valid when importing multiple '
1796 raise util.Abort(_('option "-n" not valid when importing multiple '
1797 'patches'))
1797 'patches'))
1798 imported = []
1798 if rev:
1799 if rev:
1799 # If mq patches are applied, we can only import revisions
1800 # If mq patches are applied, we can only import revisions
1800 # that form a linear path to qbase.
1801 # that form a linear path to qbase.
@@ -1847,6 +1848,7 b' class queue(object):'
1847 self.applied.insert(0, se)
1848 self.applied.insert(0, se)
1848
1849
1849 self.added.append(patchname)
1850 self.added.append(patchname)
1851 imported.append(patchname)
1850 patchname = None
1852 patchname = None
1851 if rev and repo.ui.configbool('mq', 'secret', False):
1853 if rev and repo.ui.configbool('mq', 'secret', False):
1852 # if we added anything with --rev, we must move the secret root
1854 # if we added anything with --rev, we must move the secret root
@@ -1901,9 +1903,11 b' class queue(object):'
1901 self.seriesdirty = True
1903 self.seriesdirty = True
1902 self.ui.warn(_("adding %s to series file\n") % patchname)
1904 self.ui.warn(_("adding %s to series file\n") % patchname)
1903 self.added.append(patchname)
1905 self.added.append(patchname)
1906 imported.append(patchname)
1904 patchname = None
1907 patchname = None
1905
1908
1906 self.removeundo(repo)
1909 self.removeundo(repo)
1910 return imported
1907
1911
1908 @command("qdelete|qremove|qrm",
1912 @command("qdelete|qremove|qrm",
1909 [('k', 'keep', None, _('keep patch file')),
1913 [('k', 'keep', None, _('keep patch file')),
@@ -2029,15 +2033,16 b' def qimport(ui, repo, *filename, **opts)'
2029 try:
2033 try:
2030 q = repo.mq
2034 q = repo.mq
2031 try:
2035 try:
2032 q.qimport(repo, filename, patchname=opts.get('name'),
2036 imported = q.qimport(
2033 existing=opts.get('existing'), force=opts.get('force'),
2037 repo, filename, patchname=opts.get('name'),
2034 rev=opts.get('rev'), git=opts.get('git'))
2038 existing=opts.get('existing'), force=opts.get('force'),
2039 rev=opts.get('rev'), git=opts.get('git'))
2035 finally:
2040 finally:
2036 q.savedirty()
2041 q.savedirty()
2037
2042
2038
2043
2039 if opts.get('push') and not opts.get('rev'):
2044 if imported and opts.get('push') and not opts.get('rev'):
2040 return q.push(repo, None)
2045 return q.push(repo, imported[-1])
2041 finally:
2046 finally:
2042 lock.release()
2047 lock.release()
2043 return 0
2048 return 0
@@ -153,21 +153,41 b' qimport CRLF diff'
153
153
154 try to import --push
154 try to import --push
155
155
156 $ echo another >> b
156 $ cat > appendfoo.diff <<EOF
157 $ hg diff > another.diff
157 > append foo
158 $ hg up -C
158 >
159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 > diff -r 07f494440405 -r 261500830e46 baz
160 $ hg qimport --push another.diff
160 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
161 adding another.diff to series file
161 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
162 applying another.diff
162 > @@ -0,0 +1,1 @@
163 now at: another.diff
163 > +foo
164 > EOF
165
166 $ cat > appendbar.diff <<EOF
167 > append bar
168 >
169 > diff -r 07f494440405 -r 261500830e46 baz
170 > --- a/baz Thu Jan 01 00:00:00 1970 +0000
171 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
172 > @@ -1,1 +1,2 @@
173 > foo
174 > +bar
175 > EOF
176
177 $ hg qimport --push appendfoo.diff appendbar.diff
178 adding appendfoo.diff to series file
179 adding appendbar.diff to series file
180 applying appendfoo.diff
181 applying appendbar.diff
182 now at: appendbar.diff
164 $ hg qfin -a
183 $ hg qfin -a
165 patch b.diff finalized without changeset message
184 patch b.diff finalized without changeset message
166 patch another.diff finalized without changeset message
185 $ hg qimport -r 'p1(.)::' -P
167 $ hg qimport -rtip -P
168 $ hg qpop -a
186 $ hg qpop -a
187 popping 3.diff
169 popping 2.diff
188 popping 2.diff
170 patch queue now empty
189 patch queue now empty
190 $ hg qdel 3.diff
171 $ hg qdel -k 2.diff
191 $ hg qdel -k 2.diff
172
192
173 qimport -e
193 qimport -e
General Comments 0
You need to be logged in to leave comments. Login now