Mercurial > hg
changeset 34144:91f0677dc920 stable
repair: preserve phase also when not using generaldelta (issue5678)
It seems like we used to pick the oldest possible version of the
changegroup to use for bundles created by the repair module (used
e.g. by "hg strip" and for temporary bundles by "hg rebase"). I tried
to preserve that behavior when I created the changegroup.safeversion()
method in 3b2ac2115464 (changegroup: introduce safeversion(),
2016-01-19).
However, we have recently chagned our minds and decided that these
commands are only used locally and downgrades are unlikely. That
decicion allowed us to start adding obsmarker and phase information to
these bundles. However, as the bug report shows, it means we get
different behavior e.g. when generaldelta is not enabled (because when
it was enabled, it forced us to use bundle2). The commit that actually
caused the reported bug was 8e3021fd1a44 (strip: include phases in
bundle (BC), 2017-06-15).
So, since we now depend on having more information in the bundles,
let's make sure we instead pick the newest possible changegroup
version.
Differential Revision: https://phab.mercurial-scm.org/D715
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Sep 2017 11:16:57 -0700 |
parents | b5d7e7d5c573 |
children | 1908dc958639 |
files | mercurial/changegroup.py mercurial/repair.py tests/test-rebase-scenario-global.t tests/test-strip.t |
diffstat | 4 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Thu Sep 14 11:16:47 2017 -0700 +++ b/mercurial/changegroup.py Thu Sep 14 11:16:57 2017 -0700 @@ -872,6 +872,11 @@ versions.discard('02') return versions +def localversion(repo): + # Finds the best version to use for bundles that are meant to be used + # locally, such as those from strip and shelve, and temporary bundles. + return max(supportedoutgoingversions(repo)) + def safeversion(repo): # Finds the smallest version that it's safe to assume clients of the repo # will support. For example, all hg versions that support generaldelta also
--- a/mercurial/repair.py Thu Sep 14 11:16:47 2017 -0700 +++ b/mercurial/repair.py Thu Sep 14 11:16:57 2017 -0700 @@ -38,7 +38,7 @@ totalhash = hashlib.sha1(''.join(allhashes)).hexdigest() name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix) - cgversion = changegroup.safeversion(repo) + cgversion = changegroup.localversion(repo) comp = None if cgversion != '01': bundletype = "HG20"
--- a/tests/test-rebase-scenario-global.t Thu Sep 14 11:16:47 2017 -0700 +++ b/tests/test-rebase-scenario-global.t Thu Sep 14 11:16:57 2017 -0700 @@ -399,11 +399,10 @@ $ hg rebase -s 1 -d 2 rebasing 1:d2ae7f538514 "b" saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg (glob) -BROKEN: d36c should remain public $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n' o 2:c882 draft b | - @ 1:d36c draft c + @ 1:d36c public c | o 0:cb9a public a
--- a/tests/test-strip.t Thu Sep 14 11:16:47 2017 -0700 +++ b/tests/test-strip.t Thu Sep 14 11:16:57 2017 -0700 @@ -1116,6 +1116,6 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg (glob) $ hg unbundle -q .hg/strip-backup/* -BROKEN: obsmarker got lost $ hg debugobsolete + cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} $ cd ..