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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jan 1 19:35:59 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# 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/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4627,13 +4627,16 @@ def phase(ui, repo, *revs, **opts):
             phases.advanceboundary(repo, targetphase, nodes)
             if opts['force']:
                 phases.retractboundary(repo, targetphase, nodes)
         finally:
             lock.release()
-        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))


More information about the Mercurial-devel mailing list