changeset 5212:99123c3229b4

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 27 Mar 2020 04:30:22 +0100
parents a28f24828f62 (current diff) b9b71fdea693 (diff)
children 8c131b97e197
files CHANGELOG hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/obsdiscovery.py hgext3rd/evolve/obsexchange.py tests/test-discovery-obshashrange.t tests/test-wireproto.t
diffstat 16 files changed, 235 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Wed Mar 25 17:44:08 2020 -0400
+++ b/CHANGELOG	Fri Mar 27 04:30:22 2020 +0100
@@ -6,6 +6,14 @@
 
   * compat: clean up old compatibility code
 
+9.3.0 - in progress
+-------------------
+
+  * obsexchange: avoid sending too large request to http server
+  * obsdiscovery: server no longer aborts with a 500 error if client sends a
+    request without obscommon
+  * evolve: improved behavior when evolving above the result of a split
+
 9.3.0 -- 2020-03-04
 -------------------
 
--- a/hgext3rd/evolve/obsdiscovery.py	Wed Mar 25 17:44:08 2020 -0400
+++ b/hgext3rd/evolve/obsdiscovery.py	Fri Mar 27 04:30:22 2020 +0100
@@ -824,7 +824,12 @@
     repo = pullop.repo
     remote = pullop.remote
     unfi = repo.unfiltered()
-    revs = unfi.revs(b'::(%ln - null)', pullop.common)
+    # Also exclude filtered revisions. Working on unfiltered repository can
+    # give a bit more precise view of the repository. However it makes the
+    # overall operation more complicated.
+    filteredrevs = repo.changelog.filteredrevs
+    # XXX probably not very efficient
+    revs = unfi.revs(b'::(%ln - null) - %ld', pullop.common, filteredrevs)
     boundaries = {b'heads': pullop.pulledsubset}
     if not revs: # nothing common
         boundaries[b'common'] = [node.nullid]
@@ -839,8 +844,14 @@
     if bundle2 and _canobshashrange(repo, remote):
         obsexcmsg(repo.ui, b"looking for common markers in %i nodes\n"
                   % len(revs))
-        boundaries[b'missing'] = findmissingrange(repo.ui, unfi, pullop.remote,
-                                                  revs)
+        missing = findmissingrange(repo.ui, repo, pullop.remote, revs)
+        boundaries[b'missing'] = missing
+        # using getattr since `limitedarguments` is missing
+        # hg <= 5.0 (69921d02daaf)
+        if getattr(pullop.remote, 'limitedarguments', False):
+            # prepare for a possible fallback to common
+            common = repo.set("heads(only(%ld, %ln))", revs, missing)
+            boundaries[b'common'] = [c.node() for c in common]
     else:
         boundaries[b'common'] = [node.nullid]
     return boundaries
--- a/hgext3rd/evolve/obsexchange.py	Wed Mar 25 17:44:08 2020 -0400
+++ b/hgext3rd/evolve/obsexchange.py	Fri Mar 27 04:30:22 2020 +0100
@@ -50,6 +50,18 @@
     gboptsmap[b'evo_obscommon'] = b'nodes'
     gboptsmap[b'evo_missing_nodes'] = b'nodes'
 
+ARGUMENTS_LIMIT = 200
+
+OVERFLOW_MSG = """obsmarkers differ for %d common nodes
+|
+| This might be too much for the remote HTTP server that doesn't accept
+| arguments through POST request. (config: experimental.httppostargs=yes)
+|
+| Falling back to a less efficient fetching method.
+|
+| More efficient fetching method is possible and will be used in the future.
+"""
+
 @eh.wrapfunction(exchange, '_pullbundle2extraprepare')
 def _addobscommontob2pull(orig, pullop, kwargs):
     ret = orig(pullop, kwargs)
@@ -57,18 +69,27 @@
     if (b'obsmarkers' in kwargs
         and pullop.remote.capable(b'_evoext_getbundle_obscommon')):
         boundaries = obsdiscovery.buildpullobsmarkersboundaries(pullop)
-        if b'common' in boundaries:
+        use_common = True
+        if b'missing' in boundaries:
+            use_common = False
+            missing = boundaries[b'missing']
+            # using getattr since `limitedarguments` is missing
+            # hg <= 5.0 (69921d02daaf)
+            limitedarguments = getattr(pullop.remote, 'limitedarguments', False)
+            if limitedarguments and len(missing) > ARGUMENTS_LIMIT:
+                obsexcmsg(ui, OVERFLOW_MSG % len(missing))
+                use_common = True
+            else:
+                if missing:
+                    obsexcmsg(ui, b'request obsmarkers for %d common nodes\n'
+                              % len(missing))
+                kwargs[b'evo_missing_nodes'] = missing
+        if use_common and b'common' in boundaries:
             common = boundaries[b'common']
             if common != pullop.common:
                 obsexcmsg(ui, b'request obsmarkers for some common nodes\n')
             if common != [node.nullid]:
                 kwargs[b'evo_obscommon'] = common
-        elif b'missing' in boundaries:
-            missing = boundaries[b'missing']
-            if missing:
-                obsexcmsg(ui, b'request obsmarkers for %d common nodes\n'
-                          % len(missing))
-            kwargs[b'evo_missing_nodes'] = missing
     return ret
 
 def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs):
@@ -81,8 +102,10 @@
             if heads is None:
                 heads = repo.heads()
             obscommon = kwargs.get('evo_obscommon', ())
-            assert obscommon
-            obsset = repo.unfiltered().set(b'::%ln - ::%ln', heads, obscommon)
+            if obscommon:
+                obsset = repo.unfiltered().set(b'::%ln - ::%ln', heads, obscommon)
+            else:
+                obsset = repo.unfiltered().set(b'::%ln', heads)
             subset = [c.node() for c in obsset]
         else:
             common = kwargs.get('common')
--- a/hgext3rd/evolve/utility.py	Wed Mar 25 17:44:08 2020 -0400
+++ b/hgext3rd/evolve/utility.py	Fri Mar 27 04:30:22 2020 +0100
@@ -139,10 +139,9 @@
     targets = obsutil.successorssets(repo, ctx.node())[0]
     assert targets
     targetrevs = [repo[r].rev() for r in targets]
-    roots = repo.revs(b'roots(%ld)', targetrevs)
-    heads = repo.revs(b'heads(%ld)', targetrevs)
-    if len(roots) > 1 or len(heads) > 1:
-        cheader = (_(b"ancestor '%s' split over multiple topological"
+    heads = repo.revs(b'heads(%ld::%ld)', targetrevs, targetrevs)
+    if len(heads) > 1:
+        cheader = (_(b"ancestor of '%s' split over multiple topological"
                      b" branches.\nchoose an evolve destination:") %
                    evolvecand)
         selectedrev = revselectionprompt(ui, repo, list(heads), cheader)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-discovery-hidden-common.t	Fri Mar 27 04:30:22 2020 +0100
@@ -0,0 +1,103 @@
+test for discovery with some remote changesets hidden locally
+=============================================================
+
+  $ . $TESTDIR/testlib/common.sh
+
+  $ cat << EOF >> $HGRCPATH
+  > [phases]
+  > publish = false
+  > [extensions]
+  > evolve =
+  > [experimental]
+  > verbose-obsolescence-exchange = 1
+  > [ui]
+  > logtemplate = "{rev} {node|short} {desc} {tags}\n"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
+  > EOF
+
+  $ hg init server
+  $ hg clone ssh://user@dummy/server client
+  no changes found
+  updating to branch default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd server
+  $ mkcommit root
+  $ mkcommit A0
+
+second pull:
+
+  $ hg -R ../client pull
+  pulling from ssh://user@dummy/server
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  new changesets 1e4be0697311:8aaa48160adc (2 drafts)
+  (run 'hg update' to get a working copy)
+  $ hg -R ../client log -G
+  o  1 8aaa48160adc A0 tip
+  |
+  o  0 1e4be0697311 root
+  
+
+more update
+
+  $ hg tag --local stay-visible
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mkcommit A1
+  created new head
+  $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'`
+  1 new obsolescence markers
+  obsoleted 1 changesets
+
+second pull:
+
+  $ hg -R ../client pull
+  pulling from ssh://user@dummy/server
+  searching for changes
+  OBSEXC: looking for common markers in 2 nodes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  new changesets f6082bc4ffef (1 drafts)
+  (run 'hg heads' to see heads)
+  $ hg -R ../client log -G
+  o  2 f6082bc4ffef A1 tip
+  |
+  o  0 1e4be0697311 root
+  
+
+more update:
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mkcommit A2
+  created new head
+  $ hg debugobsolete `getid 'desc(A1)'` `getid 'desc(A2)'`
+  1 new obsolescence markers
+  obsoleted 1 changesets
+
+third pull:
+
+  $ hg -R ../client pull
+  pulling from ssh://user@dummy/server
+  searching for changes
+  OBSEXC: looking for common markers in 1 nodes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  new changesets c1f8d089020f (1 drafts)
+  (run 'hg heads' to see heads)
+  $ hg -R ../client log -G
+  o  3 c1f8d089020f A2 tip
+  |
+  o  0 1e4be0697311 root
+  
--- a/tests/test-discovery-obshashrange-cache.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-discovery-obshashrange-cache.t	Fri Mar 27 04:30:22 2020 +0100
@@ -16,11 +16,9 @@
   > verbose-obsolescence-exchange=1
   > [ui]
   > logtemplate = "{rev} {node|short} {desc} {tags}\n"
-  > ssh=python "$RUNTESTDIR/dummyssh"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > [alias]
   > debugobsolete=debugobsolete -d '0 0'
-  > [ui]
-  > ssh=$PYTHON "$RUNTESTDIR/dummyssh"
   > EOF
 
   $ hg init main
--- a/tests/test-discovery-obshashrange.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-discovery-obshashrange.t	Fri Mar 27 04:30:22 2020 +0100
@@ -18,7 +18,7 @@
   > verbose-obsolescence-exchange=1
   > [ui]
   > logtemplate = "{rev} {node|short} {desc} {tags}\n"
-  > ssh=python "$RUNTESTDIR/dummyssh"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > [alias]
   > debugobsolete=debugobsolete -d '0 0'
   > EOF
@@ -193,7 +193,7 @@
   could not import hgext.hgext3rd.evolve (No module named hgext3rd.evolve): trying hgext3rd.hgext3rd.evolve (?)
   could not import hgext3rd.hgext3rd.evolve (No module named hgext3rd.evolve): trying hgext3rd.evolve (?)
   pushing to ssh://user@dummy/server
-  running python "*/dummyssh" *user@dummy* *hg -R server serve --stdio* (glob)
+  running "*python*" "*/dummyssh" *user@dummy* *hg -R server serve --stdio* (glob)
   sending hello command
   sending between command
   remote: * (glob)
@@ -324,7 +324,7 @@
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-obscache in *.???? seconds (0r, 1o) (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> debugobsolete ffffffffffffffffffffffffffffffffffffffff 45f8b879de922f6a6e620ba04205730335b6fc7e exited 0 after *.?? seconds (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> push -f --debug (glob)
-  * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> running python "*/dummyssh" *user@dummy* *hg -R server serve --stdio* (glob)
+  * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> running "*python*" "*/dummyssh" *user@dummy* *hg -R server serve --stdio* (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> sending hello command (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> sending between command (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> remote: * (glob)
--- a/tests/test-evolve-issue5832.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-evolve-issue5832.t	Fri Mar 27 04:30:22 2020 +0100
@@ -117,7 +117,7 @@
   move:[2] added b
   atop:[5] added a
   move:[4] merge commit
-  ancestor '7235ef625ea3' split over multiple topological branches.
+  ancestor of '7235ef625ea3' split over multiple topological branches.
   choose an evolve destination:
   1: [62fb70414f99] added c
   2: [5841d7cf9893] added d
@@ -257,7 +257,7 @@
   move:[2] added b
   atop:[6] added a
   move:[4] merge commit
-  ancestor 'cdf2ea1b9312' split over multiple topological branches.
+  ancestor of 'cdf2ea1b9312' split over multiple topological branches.
   choose an evolve destination:
   1: [62fb70414f99] added c
   2: [5841d7cf9893] added d
@@ -402,7 +402,7 @@
   > EOF
   move:[2] added b
   atop:[6] added a
-  ancestor 'b9b387427a53' split over multiple topological branches.
+  ancestor of 'b9b387427a53' split over multiple topological branches.
   choose an evolve destination:
   1: [62fb70414f99] added c
   2: [5841d7cf9893] added d
--- a/tests/test-evolve-orphan-split.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-evolve-orphan-split.t	Fri Mar 27 04:30:22 2020 +0100
@@ -193,7 +193,7 @@
   $ hg evolve --dry-run <<EOF
   > 1
   > EOF
-  ancestor 'd48a30875f01' split over multiple topological branches.
+  ancestor of 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
   1: [f2632392aefe] added a b c
   2: [7f87764e5b64] added a b c
@@ -206,7 +206,7 @@
   $ hg evolve --dry-run <<EOF
   > 2
   > EOF
-  ancestor 'd48a30875f01' split over multiple topological branches.
+  ancestor of 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
   1: [f2632392aefe] added a b c
   2: [7f87764e5b64] added a b c
@@ -222,7 +222,7 @@
   $ hg evolve --all <<EOF
   > foo
   > EOF
-  ancestor 'd48a30875f01' split over multiple topological branches.
+  ancestor of 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
   1: [f2632392aefe] added a b c
   2: [7f87764e5b64] added a b c
@@ -234,7 +234,7 @@
   $ hg evolve --all <<EOF
   > 4
   > EOF
-  ancestor 'd48a30875f01' split over multiple topological branches.
+  ancestor of 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
   1: [f2632392aefe] added a b c
   2: [7f87764e5b64] added a b c
@@ -246,7 +246,7 @@
   $ hg evolve --all <<EOF
   > -1
   > EOF
-  ancestor 'd48a30875f01' split over multiple topological branches.
+  ancestor of 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
   1: [f2632392aefe] added a b c
   2: [7f87764e5b64] added a b c
@@ -258,7 +258,7 @@
   $ hg evolve --all <<EOF
   > q
   > EOF
-  ancestor 'd48a30875f01' split over multiple topological branches.
+  ancestor of 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
   1: [f2632392aefe] added a b c
   2: [7f87764e5b64] added a b c
@@ -271,7 +271,7 @@
   $ hg evolve --all <<EOF
   > 1
   > EOF
-  ancestor 'd48a30875f01' split over multiple topological branches.
+  ancestor of 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
   1: [f2632392aefe] added a b c
   2: [7f87764e5b64] added a b c
--- a/tests/test-evolve-serveronly-bundle2.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-evolve-serveronly-bundle2.t	Fri Mar 27 04:30:22 2020 +0100
@@ -8,7 +8,7 @@
   > push_ssl = false
   > allow_push = *
   > [ui]
-  > ssh=python "$RUNTESTDIR/dummyssh"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > [phases]
   > publish = False
   > [experimental]
--- a/tests/test-evolve-split.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-evolve-split.t	Fri Mar 27 04:30:22 2020 +0100
@@ -59,3 +59,56 @@
   $ hg evolve --rev "0::"
   move:[2] add uu
   atop:[4] _pp
+
+  $ cd ..
+  $ hg init split-merged
+  $ cd split-merged
+  $ mkcommit aa
+
+Split the changeset such that the successors don't have a single root and there's an unrelated changeset in between
+  $ printf "oo" > oo;
+  $ printf "pp" > pp;
+  $ printf "qq" > qq;
+  $ hg add oo pp qq
+  $ hg commit -m "oo+pp+qq"
+  $ mkcommit uu
+  $ hg up 0
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ printf "oo" > oo;
+  $ hg add oo
+  $ hg commit -m "_oo"
+  created new head
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ printf "pp" > pp;
+  $ hg add pp
+  $ hg commit -m "_pp"
+  created new head
+  $ hg merge 3
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'merge oo and pp'
+  $ printf "qq" > qq;
+  $ hg add qq
+  $ hg commit -m "_qq"
+  $ hg prune --successor "desc(_oo) + desc(_pp) + desc(_qq)" -r "desc('oo+pp+qq')" --split
+  1 changesets pruned
+  1 new orphan changesets
+  $ hg log -G
+  @  6:ea5b1e180c04@default(draft) _qq
+  |
+  o    5:bf7c32161b4b@default(draft) merge oo and pp
+  |\
+  | o  4:ece0aaa22eb7@default(draft) _pp
+  | |
+  o |  3:a7fdfda64c08@default(draft) _oo
+  |/
+  | *  2:cc56c47d84b3@default(draft) add uu
+  | |
+  | x  1:575a7380a87d@default(draft) oo+pp+qq
+  |/
+  o  0:58663bb03074@default(draft) add aa
+  
+  $ hg evolve --rev "0::"
+  move:[2] add uu
+  atop:[6] _qq
--- a/tests/test-push-checkheads-pruned-B5.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-push-checkheads-pruned-B5.t	Fri Mar 27 04:30:22 2020 +0100
@@ -27,11 +27,11 @@
 ..
 .. graph-summary:
 ..
-..   B ⊗
+..   C ⊗
 ..     |
-..   A ø⇠◔ A'
+..   B ø⇠◔ B'
 ..     | |
-..   B ⊗ |
+..   A ⊗ |
 ..     |/
 ..     ●
 
--- a/tests/test-topic-push-concurrent-on.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-topic-push-concurrent-on.t	Fri Mar 27 04:30:22 2020 +0100
@@ -5,7 +5,7 @@
   $ cat << EOF >> $HGRCPATH
   > [ui]
   > logtemplate = {rev} {branch} {get(namespaces, "topics")} {phase} {desc|firstline}\n
-  > ssh =python "$RUNTESTDIR/dummyssh"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > [server]
   > concurrent-push-mode=check-related
   > EOF
--- a/tests/test-topic-push.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-topic-push.t	Fri Mar 27 04:30:22 2020 +0100
@@ -3,7 +3,7 @@
   $ cat << EOF >> $HGRCPATH
   > [ui]
   > logtemplate = {rev} {branch} {get(namespaces, "topics")} {phase} {desc|firstline}\n
-  > ssh =python "$RUNTESTDIR/dummyssh"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > EOF
 
   $ hg init main
--- a/tests/test-wireproto-bundle1.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-wireproto-bundle1.t	Fri Mar 27 04:30:22 2020 +0100
@@ -3,7 +3,7 @@
   > [defaults]
   > amend=-d "0 0"
   > [ui]
-  > ssh=python "$RUNTESTDIR/dummyssh"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > [phases]
   > publish = False
   > [extensions]
--- a/tests/test-wireproto.t	Wed Mar 25 17:44:08 2020 -0400
+++ b/tests/test-wireproto.t	Fri Mar 27 04:30:22 2020 +0100
@@ -6,7 +6,7 @@
   > obsmarkers-exchange-debug=true
   > bundle2-exp=true
   > [ui]
-  > ssh=python "$RUNTESTDIR/dummyssh"
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > [phases]
   > publish = False
   > [extensions]