Patchwork [3,of,4] phases: prepare phase command for filtering

mail settings
Submitter Pierre-Yves David
Date Jan. 2, 2013, 1:35 a.m.
Message ID <d2f15a6470d3566b7223.1357090559@yamac.lan>
Download mbox | patch
Permalink /patch/364/
State Accepted
Commit f730ed2e093d625bdd267412120ad96aa3403707
Headers show


Pierre-Yves David - Jan. 2, 2013, 1:35 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at>
# Date 1356346720 -3600
# Node ID d2f15a6470d3566b722379d48da8c88b26f398fd
# Parent  582c14e67f556532de2822fd3850e697406b1b6e
phases: prepare phase command for filtering

The phase command have some logic to report change made. We ensure this logic
run unfiltered.

With --force the command can change phase of a changeset for public to draft.
Such change can lead to obsolescence marker to apply again and the changeset to
be "hidden". If we do not run the logic unfiltered it could failed to fetch the
phase of a newly filtered changeset.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -4627,13 +4627,16 @@  def phase(ui, repo, *revs, **opts):
             phases.advanceboundary(repo, targetphase, nodes)
             if opts['force']:
                 phases.retractboundary(repo, targetphase, nodes)
-        newdata = repo._phasecache.getphaserevs(repo)
-        cl = repo.changelog
+        # moving revision from public to draft may hide them
+        # We have to check result on an unfiltered repository
+        unfi = repo.unfiltered()
+        newdata = repo._phasecache.getphaserevs(unfi)
         changes = sum(o != newdata[i] for i, o in enumerate(olddata))
+        cl = unfi.changelog
         rejected = [n for n in nodes
                     if newdata[cl.rev(n)] < targetphase]
         if rejected:
             ui.warn(_('cannot move %i changesets to a more permissive '
                       'phase, use --force\n') % len(rejected))