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