##// END OF EJS Templates
mq: turn changeset draft on qfinish (except if qparent is secret)...
Pierre-Yves David -
r15920:885e0c71 default
parent child Browse files
Show More
@@ -46,7 +46,7 b' from mercurial.i18n import _'
46 from mercurial.node import bin, hex, short, nullid, nullrev
46 from mercurial.node import bin, hex, short, nullid, nullrev
47 from mercurial.lock import release
47 from mercurial.lock import release
48 from mercurial import commands, cmdutil, hg, scmutil, util, revset
48 from mercurial import commands, cmdutil, hg, scmutil, util, revset
49 from mercurial import repair, extensions, url, error
49 from mercurial import repair, extensions, url, error, phases
50 from mercurial import patch as patchmod
50 from mercurial import patch as patchmod
51 import os, re, errno, shutil
51 import os, re, errno, shutil
52
52
@@ -750,6 +750,7 b' class queue(object):'
750 for p in patches:
750 for p in patches:
751 os.unlink(self.join(p))
751 os.unlink(self.join(p))
752
752
753 qfinished = []
753 if numrevs:
754 if numrevs:
754 qfinished = self.applied[:numrevs]
755 qfinished = self.applied[:numrevs]
755 del self.applied[:numrevs]
756 del self.applied[:numrevs]
@@ -776,6 +777,7 b' class queue(object):'
776
777
777 self.parseseries()
778 self.parseseries()
778 self.seriesdirty = True
779 self.seriesdirty = True
780 return [entry.node for entry in qfinished]
779
781
780 def _revpatches(self, repo, revs):
782 def _revpatches(self, repo, revs):
781 firstrev = repo[self.applied[0].node].rev()
783 firstrev = repo[self.applied[0].node].rev()
@@ -803,7 +805,11 b' class queue(object):'
803
805
804 def finish(self, repo, revs):
806 def finish(self, repo, revs):
805 patches = self._revpatches(repo, sorted(revs))
807 patches = self._revpatches(repo, sorted(revs))
806 self._cleanup(patches, len(patches))
808 qfinished = self._cleanup(patches, len(patches))
809 if qfinished:
810 oldqbase = repo[qfinished[0]]
811 if oldqbase.p1().phase() < phases.secret:
812 phases.advanceboundary(repo, phases.draft, [oldqbase.node()])
807
813
808 def delete(self, repo, patches, opts):
814 def delete(self, repo, patches, opts):
809 if not patches and not opts.get('rev'):
815 if not patches and not opts.get('rev'):
@@ -2918,9 +2924,15 b' def finish(ui, repo, *revrange, **opts):'
2918 revs = scmutil.revrange(repo, revrange)
2924 revs = scmutil.revrange(repo, revrange)
2919 if repo['.'].rev() in revs and repo[None].files():
2925 if repo['.'].rev() in revs and repo[None].files():
2920 ui.warn(_('warning: uncommitted changes in the working directory\n'))
2926 ui.warn(_('warning: uncommitted changes in the working directory\n'))
2921
2927 # queue.finish may changes phases but leave the responsability to lock the
2922 q.finish(repo, revs)
2928 # repo to the caller to avoid deadlock with wlock. This command code is
2923 q.savedirty()
2929 # responsability for this locking.
2930 lock = repo.lock()
2931 try:
2932 q.finish(repo, revs)
2933 q.savedirty()
2934 finally:
2935 lock.release()
2924 return 0
2936 return 0
2925
2937
2926 @command("qqueue",
2938 @command("qqueue",
General Comments 0
You need to be logged in to leave comments. Login now