Mercurial > evolve
changeset 5935:aff365171309
branching: merge with stable
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 25 May 2021 18:46:09 +0200 |
parents | aca07ac01167 (current diff) 6f8ab1030374 (diff) |
children | daca8f4f7014 |
files | CHANGELOG hgext3rd/evolve/__init__.py hgext3rd/topic/__init__.py tests/test-check-sdist.t tests/test-prev-next.t |
diffstat | 13 files changed, 280 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG Wed Mar 03 12:40:59 2021 +0530 +++ b/CHANGELOG Tue May 25 18:46:09 2021 +0200 @@ -8,6 +8,17 @@ * evolve: use a more stable criteria for picking p1 when solving content-divergence (most recent evolution will be used). +10.3.2 - in progress +-------------------- + + * next: remove duplicated targets when updating from an unstable changeset + * evolve: use "served" repo filter to guess what the server will publish + +topic (0.22.2) + + * topic: don't lose any file changes when changing topic of a merge commit + * topic: announce ext-topics-publish capability in case of SSH and HTTP too + 10.3.1 -- 2021-04-25 --------------------
--- a/hgext3rd/evolve/__init__.py Wed Mar 03 12:40:59 2021 +0530 +++ b/hgext3rd/evolve/__init__.py Tue May 25 18:46:09 2021 +0200 @@ -882,6 +882,11 @@ if repo[rev].topic() != topic) aspchildren = [rev for rev in aspchildren if rev not in filtered] + # Let's make sure we don't have any duplicates between children and + # aspiring children + filtered.update(ctx.rev() for ctx in children) + aspchildren = [rev for rev in aspchildren if rev not in filtered] + # To catch and prevent the case when `next` would get confused by split, # lets filter those aspiring children which can be stablized on one of # the aspiring children itself. @@ -898,8 +903,7 @@ if needevolve and opts['evolve']: hint = _(b'use `hg amend`, `hg revert` or `hg shelve`') cmdutil.bailifchanged(repo, hint=hint) - - if not (opts['merge'] or (needevolve and opts['evolve'])): + elif not opts['merge']: # we only skip the check if noconflict is set if ui.config(b'commands', b'update.check') == b'noconflict': pass
--- a/hgext3rd/evolve/safeguard.py Wed Mar 03 12:40:59 2021 +0530 +++ b/hgext3rd/evolve/safeguard.py Tue May 25 18:46:09 2021 +0200 @@ -38,6 +38,10 @@ published = repo.filtered(b'served').revs(b"not public()") else: published = repo.revs(b"::%ln - public()", pushop.revs) + # we want to use pushop.revs in the revset even if they + # themselves are secret, but we don't want to have anything + # that the server won't see in the result of this expression + published &= repo.filtered(b'served') if published: if behavior == b'warn': ui.warn(_(b'%i changesets about to be published\n')
--- a/hgext3rd/topic/__init__.py Wed Mar 03 12:40:59 2021 +0530 +++ b/hgext3rd/topic/__init__.py Tue May 25 18:46:09 2021 +0200 @@ -589,7 +589,9 @@ topicmodeserver = self.ui.config(b'experimental', b'topic-mode.server', b'ignore') - ispush = (desc.startswith(b'push') or desc.startswith(b'serve')) + publishbare = self.ui.configbool(b'experimental', + b'topic.publish-bare-branch') + ispush = desc.startswith((b'push', b'serve')) if (topicmodeserver != b'ignore' and ispush): if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) origvalidator = tr.validator @@ -615,10 +617,7 @@ else: tr.addvalidator(b'000-reject-untopiced', _validate) - elif (self.ui.configbool(b'experimental', b'topic.publish-bare-branch') - and (desc.startswith(b'push') - or desc.startswith(b'serve')) - ): + elif publishbare and ispush: origclose = tr.close trref = weakref.ref(tr) @@ -1060,6 +1059,14 @@ for r in revs: c = repo[r] + if len(c.parents()) > 1: + # ctx.files() isn't reliable for merges, so fall back to the + # slower repo.status() method + st = c.p1().status(c) + files = set(st.modified) | set(st.added) | set(st.removed) + else: + files = set(c.files()) + def filectxfn(repo, ctx, path): try: return c[path] @@ -1098,7 +1105,7 @@ mc = context.memctx(repo, (p1, p2), c.description(), - c.files(), + files, filectxfn, user=c.user(), date=c.date(),
--- a/hgext3rd/topic/flow.py Wed Mar 03 12:40:59 2021 +0530 +++ b/hgext3rd/topic/flow.py Tue May 25 18:46:09 2021 +0200 @@ -152,6 +152,11 @@ published = repo.filtered(b'served').revs(b'not public()') else: published = repo.revs(b'::%ln - public()', pushop.revs) + # we want to use pushop.revs in the revset even if they themselves are + # secret, but we don't want to have anything that the server won't see + # in the result of this expression + published &= repo.filtered(b'served') + if mode == b'auto': published = repo.revs(b'%ld::(%ld - topic())', published, published) if published:
--- a/hgext3rd/topic/server.py Wed Mar 03 12:40:59 2021 +0530 +++ b/hgext3rd/topic/server.py Tue May 25 18:46:09 2021 +0200 @@ -71,6 +71,13 @@ caps = orig(repo, proto) if common.hastopicext(repo) and repo.peer().capable(b'topics'): caps.append(b'_exttopics_heads') + if repo.ui.configbool(b'phases', b'publish'): + mode = b'all' + elif repo.ui.configbool(b'experimental', b'topic.publish-bare-branch'): + mode = b'auto' + else: + mode = b'none' + caps.append(b'ext-topics-publish=%s' % mode) return caps def setupserver(ui):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-amend-merge.t Tue May 25 18:46:09 2021 +0200 @@ -0,0 +1,98 @@ +This test amends a merge commit using various commands, including topics + + $ . $TESTDIR/testlib/common.sh + + $ cat >> $HGRCPATH << EOF + > [extensions] + > evolve = + > topic = + > EOF + + $ hg init amending-a-merge + $ cd amending-a-merge + + $ mkcommit root + $ mkcommit apple + $ hg up 'desc("root")' + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ mkcommit banana + created new head + (consider using topic for lightweight branches. See 'hg help topic') + $ hg up 'desc("apple")' + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg merge 'desc("banana")' + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ hg ci -m merge + $ hg diff -r 'p1(.)' -r '.' + diff -r 88a060ab6523 -r c20705a6a8c4 banana + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/banana Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +banana + $ hg diff -r 'p2(.)' -r '.' + diff -r d8c7baf0ca58 -r c20705a6a8c4 apple + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/apple Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +apple + +amend + + $ hg amend -m 'merge, amend' + $ hg diff -r 'p1(.)' -r '.' + diff -r 88a060ab6523 -r 456753fae3cd banana + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/banana Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +banana + $ hg diff -r 'p2(.)' -r '.' + diff -r d8c7baf0ca58 -r 456753fae3cd apple + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/apple Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +apple + +metaedit + + $ hg metaedit -m 'merge, metaedit' + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg diff -r 'p1(.)' -r '.' + diff -r 88a060ab6523 -r 1528d42f3e83 banana + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/banana Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +banana + $ hg diff -r 'p2(.)' -r '.' + diff -r d8c7baf0ca58 -r 1528d42f3e83 apple + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/apple Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +apple + +topics + + $ hg topics -r . foo + switching to topic foo + changed topic on 1 changesets to "foo" + $ hg diff -r 'p1(.)' -r '.' + diff -r 88a060ab6523 -r 52150b9639f7 banana + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/banana Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +banana + $ hg diff -r 'p2(.)' -r '.' + diff -r d8c7baf0ca58 -r 52150b9639f7 apple + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/apple Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +apple + + $ hg files + apple + banana + root + $ hg cat apple banana + apple + banana
--- a/tests/test-check-sdist.t Wed Mar 03 12:40:59 2021 +0530 +++ b/tests/test-check-sdist.t Tue May 25 18:46:09 2021 +0200 @@ -35,7 +35,7 @@ $ tar -tzf hg-evolve-*.tar.gz | sed 's|^hg-evolve-[^/]*/||' | sort > files $ wc -l files - 350 files + 351 files $ fgrep debian files tests/test-check-debian.t $ fgrep __init__.py files
--- a/tests/test-extension-isolation.t Wed Mar 03 12:40:59 2021 +0530 +++ b/tests/test-extension-isolation.t Tue May 25 18:46:09 2021 +0200 @@ -132,6 +132,7 @@ [1] $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext' _exttopics_heads + ext-topics-publish=all topics $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext' [1] @@ -145,12 +146,14 @@ _evoext_getbundle_obscommon _evoext_obshashrange_v1 _exttopics_heads + ext-topics-publish=all topics $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext' _evoext_getbundle_obscommon _evoext_obshashrange_v1 $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext' _exttopics_heads + ext-topics-publish=all topics $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext' _evoext_getbundle_obscommon
--- a/tests/test-obsolete-push.t Wed Mar 03 12:40:59 2021 +0530 +++ b/tests/test-obsolete-push.t Tue May 25 18:46:09 2021 +0200 @@ -60,7 +60,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd strict-publish-client $ echo c > c - $ hg ci -qAm C c + $ hg ci -qAm C c --secret abort behavior @@ -70,6 +70,17 @@ > eof $ hg push -r . pushing to $TESTTMP/source + searching for changes + no changes found (ignored 1 secret changesets) + [1] + $ hg push + pushing to $TESTTMP/source + searching for changes + no changes found (ignored 1 secret changesets) + [1] + $ hg phase --draft + $ hg push -r . + pushing to $TESTTMP/source abort: push would publish 1 changesets (* 'experimental.auto-publish' config) (glob) [255]
--- a/tests/test-prev-next.t Wed Mar 03 12:40:59 2021 +0530 +++ b/tests/test-prev-next.t Tue May 25 18:46:09 2021 +0200 @@ -651,3 +651,58 @@ $ hg next --abort --merge abort: cannot specify both --abort and --merge [10] + + $ cd .. + +Testing --merge and --evolve flags: 1 child, 1 aspchild, dirty working copy + + $ hg init next-dirty-evolve + $ cd next-dirty-evolve + + $ echo apple > a + $ hg ci -qAm apple + $ echo banana > b + $ hg ci -qAm banana + $ echo coconut > c + $ hg ci -qAm coconut + + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [1] banana + $ echo blueberry > b + $ hg ci --amend -m blueberry + 1 new orphan changesets + + $ echo durian > d + $ hg ci -qAm durian + $ hg log -GT "{rev} {desc}\n" + @ 4 durian + | + o 3 blueberry + | + | * 2 coconut + | | + | x 1 banana + |/ + o 0 apple + + + $ hg up 'desc("blueberry")' + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo avocado > a + + $ hg next --no-merge --evolve --dry-run + abort: uncommitted changes + (use `hg amend`, `hg revert` or `hg shelve`) + [20] + $ hg next --no-merge --no-evolve --dry-run + abort: uncommitted changes + (do you want --merge?) + [20] + $ hg next --merge --no-evolve --dry-run + hg update db0dc1f00682; + [4] durian + $ hg next --merge --evolve --dry-run + abort: uncommitted changes + (use `hg amend`, `hg revert` or `hg shelve`) + [20]
--- a/tests/test-topic-flow-publish-bare.t Wed Mar 03 12:40:59 2021 +0530 +++ b/tests/test-topic-flow-publish-bare.t Tue May 25 18:46:09 2021 +0200 @@ -5,6 +5,17 @@ $ . "$TESTDIR/testlib/topic_setup.sh" $ . "$TESTDIR/testlib/common.sh" +Also testing auto-publish config option with this publishing mode + + $ cat << EOF >> "$HGRCPATH" + > [ui] + > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh" + > [experimental] + > auto-publish = warn + > [alias] + > tgl = log --rev 'sort(\$1, "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + > EOF + Publishing of bare branch ========================= @@ -32,12 +43,13 @@ $ mkcommit c_dB0 $ hg push pushing to $TESTTMP/bare-branch-server + 1 changesets about to be published searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - $ hg log --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' @ 2:286d02a6e2a2 c_dB0 public default | o 1:134bc3852ad2 c_dA0 public default @@ -60,12 +72,13 @@ (consider using topic for lightweight branches. See 'hg help topic') $ hg push -f pushing to $TESTTMP/bare-branch-server + 2 changesets about to be published searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files (+2 heads) - $ hg log --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' @ 4:9bf953aa81f6 c_dD0 public default | | o 3:9d5b8e1f08a4 c_dC0 public default @@ -88,12 +101,13 @@ $ mkcommit c_aE0 $ hg push --new-branch pushing to $TESTTMP/bare-branch-server + 1 changesets about to be published searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - $ hg log --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' @ 5:0db08e758601 c_aE0 public branchA | | o 4:9bf953aa81f6 c_dD0 public default @@ -124,7 +138,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - $ hg log --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' @ 6:0867c4471796 c_dF0 draft default foo | o 4:9bf953aa81f6 c_dD0 public default @@ -153,12 +167,13 @@ (see 'hg help topics' for more information) $ hg push pushing to $TESTTMP/bare-branch-server + 1 changesets about to be published searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files - $ hg log --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' @ 8:858be9a8daaf c_dH0 draft default bar | o 7:0e4041d324d0 c_dG0 public default @@ -193,12 +208,13 @@ $ mkcommit c_aK0 $ hg push pushing to $TESTTMP/bare-branch-server + 2 changesets about to be published searching for changes adding changesets adding manifests adding file changes added 3 changesets with 3 changes to 3 files - $ hg log --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' @ 11:b0a00ebdfd24 c_aK0 public branchA | o 5:0db08e758601 c_aE0 public branchA @@ -235,12 +251,13 @@ $ hg ci -m 'c_dL0' $ hg push pushing to $TESTTMP/bare-branch-server + 2 changesets about to be published searching for changes adding changesets adding manifests adding file changes added 1 changesets with 0 changes to 0 files (-1 heads) - $ hg log --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' @ 12:a6f9f8c6c6cc c_dL0 public default |\ | o 9:4b5570d89f0f c_dI0 public default @@ -267,7 +284,7 @@ |/ o 0:ea207398892e ROOT public default - $ hg log -R ../bare-branch-server --rev 'sort(all(), "topo")' -GT '{rev}:{node|short} {desc} {phase} {branch} {topics}' + $ hg tgl 'all()' -R ../bare-branch-server o 12:a6f9f8c6c6cc c_dL0 public default |\ | o 9:4b5570d89f0f c_dI0 public default @@ -328,12 +345,33 @@ $ hg up branchA 2 files updated, 0 files merged, 5 files removed, 0 files unresolved +Making sure the topic-publishing mode is announced as a capability + + $ hg debugcapabilities $TESTTMP/bare-branch-server | grep topics + ext-topics-publish=auto + topics + $ hg debugcapabilities ssh://user@dummy/bare-branch-server | grep topics + _exttopics_heads + ext-topics-publish=auto + topics + $ hg serve -R ../bare-branch-server -p $HGPORT -d --pid-file hg.pid + $ cat hg.pid >> $DAEMON_PIDS + $ hg debugcapabilities http://localhost:$HGPORT | grep topics + _exttopics_heads + ext-topics-publish=auto + topics + $ killdaemons.py + Trying to push changeset without topic (would publish them) $ mkcommit c_aM0 - $ hg debugcapabilities $TESTTMP/bare-branch-server | grep topics - ext-topics-publish=auto - topics + $ hg phase --secret --force + $ hg push --config experimental.auto-publish=abort -r . + pushing to $TESTTMP/bare-branch-server + searching for changes + no changes found (ignored 1 secret changesets) + [1] + $ hg phase --draft $ hg push --config experimental.auto-publish=abort -r . pushing to $TESTTMP/bare-branch-server abort: push would publish 1 changesets @@ -351,7 +389,7 @@ $ hg topic test-push-protection marked working directory as topic: test-push-protection - $ mkcommit c_aL0 + $ mkcommit c_aN0 active topic 'test-push-protection' grew its first changeset (see 'hg help topics' for more information) $ hg push --config experimental.auto-publish=abort -r .
--- a/tests/test-topic-prev-next.t Wed Mar 03 12:40:59 2021 +0530 +++ b/tests/test-topic-prev-next.t Tue May 25 18:46:09 2021 +0200 @@ -133,8 +133,23 @@ o 0 [] root +Simply walking on unstable changesets should work as expected + + $ hg up 'desc("B2")' + switching to topic B + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [s1] B1 + $ hg next + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [s2] B2 + B1 shouldn't be considered a target, orphan or not + $ hg up 'desc("A2")' + switching to topic A + 1 files updated, 0 files merged, 2 files removed, 0 files unresolved $ hg next move:[s3] A3 atop:[s2] A2