equal
deleted
inserted
replaced
1793 rev = scmutil.revrange(repo, rev) |
1793 rev = scmutil.revrange(repo, rev) |
1794 rev.sort(reverse=True) |
1794 rev.sort(reverse=True) |
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. |
1801 # Otherwise, they should form a linear path to a head. |
1802 # Otherwise, they should form a linear path to a head. |
1802 heads = repo.changelog.heads(repo.changelog.node(rev[-1])) |
1803 heads = repo.changelog.heads(repo.changelog.node(rev[-1])) |
1845 |
1846 |
1846 se = statusentry(n, patchname) |
1847 se = statusentry(n, patchname) |
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 |
1853 phases.retractboundary(repo, phases.secret, [n]) |
1855 phases.retractboundary(repo, phases.secret, [n]) |
1854 self.parseseries() |
1856 self.parseseries() |
1899 self.fullseries[index:index] = [patchname] |
1901 self.fullseries[index:index] = [patchname] |
1900 self.parseseries() |
1902 self.parseseries() |
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')), |
1910 ('r', 'rev', [], |
1914 ('r', 'rev', [], |
1911 _('stop managing a revision (DEPRECATED)'), _('REV'))], |
1915 _('stop managing a revision (DEPRECATED)'), _('REV'))], |
2027 """ |
2031 """ |
2028 lock = repo.lock() # cause this may move phase |
2032 lock = repo.lock() # cause this may move phase |
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 |
2044 |
2049 |
2045 def qinit(ui, repo, create): |
2050 def qinit(ui, repo, create): |