Mercurial > hg
changeset 23361:936b0ff34346
phases: read pending data when appropriate
If we are called by a hook and pending data exists, read those.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 17 Oct 2014 22:23:06 -0700 |
parents | e06daad65f85 |
children | cc83cac41619 |
files | mercurial/phases.py tests/test-bundle2-exchange.t |
diffstat | 2 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/phases.py Sun Sep 28 21:27:48 2014 -0700 +++ b/mercurial/phases.py Fri Oct 17 22:23:06 2014 -0700 @@ -100,6 +100,7 @@ """ +import os import errno from node import nullid, nullrev, bin, hex, short from i18n import _ @@ -124,7 +125,15 @@ dirty = False roots = [set() for i in allphases] try: - f = repo.sopener('phaseroots') + f = None + if 'HG_PENDING' in os.environ: + try: + f = repo.svfs('phaseroots.pending') + except IOError, inst: + if inst.errno != errno.ENOENT: + raise + if f is None: + f = repo.sopener('phaseroots') try: for line in f: phase, nh = line.split()
--- a/tests/test-bundle2-exchange.t Sun Sep 28 21:27:48 2014 -0700 +++ b/tests/test-bundle2-exchange.t Fri Oct 17 22:23:06 2014 -0700 @@ -61,7 +61,7 @@ adding file changes added 2 changesets with 2 changes to 2 files 1 new obsolescence markers - pre-close-tip:9520eea781bc public + pre-close-tip:9520eea781bc draft postclose-tip:9520eea781bc draft b2x-transactionclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main changegroup hook: HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_SOURCE=pull HG_URL=file:$TESTTMP/main @@ -86,7 +86,7 @@ adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) 1 new obsolescence markers - pre-close-tip:24b6387c8c8c public + pre-close-tip:24b6387c8c8c draft postclose-tip:24b6387c8c8c draft b2x-transactionclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main changegroup hook: HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_SOURCE=pull HG_URL=file:$TESTTMP/main @@ -166,7 +166,7 @@ $ hg -R main push other --rev eea13746799a --bookmark book_eea1 pushing to other searching for changes - pre-close-tip:eea13746799a draft book_eea1 + pre-close-tip:eea13746799a public book_eea1 postclose-tip:eea13746799a public book_eea1 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_URL=push changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_SOURCE=push HG_URL=push @@ -201,7 +201,7 @@ added 1 changesets with 1 changes to 1 files (+1 heads) 1 new obsolescence markers updating bookmark book_02de - pre-close-tip:02de42196ebe public book_02de + pre-close-tip:02de42196ebe draft book_02de postclose-tip:02de42196ebe draft book_02de b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=ssh://user@dummy/main changegroup hook: HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_SOURCE=pull HG_URL=ssh://user@dummy/main @@ -226,7 +226,7 @@ added 1 changesets with 1 changes to 1 files (+1 heads) 1 new obsolescence markers updating bookmark book_42cc - pre-close-tip:42ccdea3bb16 public book_42cc + pre-close-tip:42ccdea3bb16 draft book_42cc postclose-tip:42ccdea3bb16 draft book_42cc b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/ changegroup hook: HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/