changeset 35832:0c14b3f23294 stable

test-subrepo: demonstrate problems with subrepo sharing and absolute paths This affects remote paths in .hgsub, as well as clone pooling from a remote source. For reasons unknown, there are stability issues with the relative-path.t tests. If run as a single test, it is stable. If run with --loop, or with -jX for X>1, the hash of the parent repo changes. I'm seeing this on both Windows and Fedora 26. I added an `hg log --debug`, and the manifest hash changes, but I have no idea why.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 28 Feb 2018 00:29:27 -0500
parents 0a7c59a4c835
children eed02e192770
files tests/test-subrepo-recursion.t tests/test-subrepo-relative-path.t
diffstat 2 files changed, 96 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-subrepo-recursion.t	Wed Feb 21 21:14:05 2018 +0900
+++ b/tests/test-subrepo-recursion.t	Wed Feb 28 00:29:27 2018 -0500
@@ -292,6 +292,25 @@
   z2
   z3
 
+BUG: The remote subrepo should be cloned to the local pool, and then shared
+from there.
+
+  $ hg --config extensions.share= --config share.pool=$TESTTMP/pool \
+  >    clone http://localhost:$HGPORT shared
+  (sharing from new pooled repository 23376cbba0d87c15906bb3652584927c140907bf)
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 5 changes to 3 files
+  new changesets 23376cbba0d8:1326fa26d0c0
+  searching for changes
+  no changes found
+  updating working directory
+  sharing subrepo foo from http://localhost:$HGPORT/foo
+  abort: can only share local repositories (in subrepository "foo")
+  [255]
+
   $ cat access.log
   * "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
   * "GET /?cmd=batch HTTP/1.1" 200 - * (glob)
@@ -302,6 +321,14 @@
   * "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob)
   * "GET /foo/bar?cmd=batch HTTP/1.1" 200 - * (glob)
   * "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - * (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=0 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=1326fa26d0c00d2146c63b56bb6a45149d7325ac&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D1326fa26d0c00d2146c63b56bb6a45149d7325ac x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=1326fa26d0c00d2146c63b56bb6a45149d7325ac&heads=1326fa26d0c00d2146c63b56bb6a45149d7325ac&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=capabilities HTTP/1.1" 200 - (glob)
 
   $ killdaemons.py
   $ rm hg1.pid error.log access.log
@@ -485,6 +512,22 @@
   commit: (clean)
   update: 4 new changesets (update)
 
+Sharing a local repo without the locally referenced subrepo (i.e. it was never
+updated from null), fails the same as a clone operation.
+
+  $ hg --config progress.disable=True clone -U ../empty ../empty2
+
+  $ hg --config extensions.share= --config progress.disable=True \
+  >    share ../empty2 ../empty_share
+  updating working directory
+  abort: repository $TESTTMP/empty2/foo not found!
+  [255]
+
+  $ hg --config progress.disable=True clone ../empty2 ../empty_clone
+  updating to branch default
+  abort: repository $TESTTMP/empty2/foo not found!
+  [255]
+
 Disable progress extension and cleanup:
 
   $ mv $HGRCPATH.no-progress $HGRCPATH
--- a/tests/test-subrepo-relative-path.t	Wed Feb 21 21:14:05 2018 +0900
+++ b/tests/test-subrepo-relative-path.t	Wed Feb 28 00:29:27 2018 -0500
@@ -72,6 +72,59 @@
    source   ../sub
    revision 863c1745b441bd97a8c4a096e87793073f4fb215
 
+Test sharing with a remote URL reference
+
+  $ hg init absolute_subrepo
+  $ cd absolute_subrepo
+  $ echo foo > foo.txt
+  $ hg ci -Am 'initial commit'
+  adding foo.txt
+  $ echo "sub = http://localhost:$HGPORT/sub" > .hgsub
+  $ hg ci -Am 'add absolute subrepo'
+  adding .hgsub
+  $ cd ..
+
+BUG: Remote subrepos cannot be shared, and pooled repos don't have their
+relative subrepos in the relative location stated in .hgsub.
+
+  $ hg --config extensions.share= --config share.pool=$TESTTMP/pool \
+  >    clone absolute_subrepo cloned_from_abs
+  (sharing from new pooled repository 8d6a2f1e993b34b6557de0042cfe825ae12a8dae)
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 3 changes to 3 files
+  new changesets 8d6a2f1e993b:c6d0e6ebd1c9
+  searching for changes
+  no changes found
+  updating working directory
+  sharing subrepo sub from http://localhost:$HGPORT/sub
+  abort: can only share local repositories (in subrepository "sub")
+  [255]
+
+  $ hg --config extensions.share= share absolute_subrepo shared_from_abs
+  updating working directory
+  sharing subrepo sub from http://localhost:$HGPORT/sub
+  abort: can only share local repositories (in subrepository "sub")
+  [255]
+
+  $ hg --config extensions.share= share -U absolute_subrepo shared_from_abs2
+  $ hg -R shared_from_abs2 update -r tip
+  sharing subrepo sub from http://localhost:$HGPORT/sub
+  abort: can only share local repositories (in subrepository "sub")
+  [255]
+
+BUG: A repo without its subrepo available locally should be sharable if the
+subrepo is referenced by absolute path.
+
+  $ hg clone -U absolute_subrepo cloned_null_from_abs
+  $ hg --config extensions.share= share cloned_null_from_abs shared_from_null_abs
+  updating working directory
+  sharing subrepo sub from http://localhost:$HGPORT/sub
+  abort: can only share local repositories (in subrepository "sub")
+  [255]
+
   $ killdaemons.py
 
 subrepo paths with ssh urls