tests/test-subrepo-relative-path.t
author Gregory Szorc <gregory.szorc@gmail.com>
Wed, 08 Jul 2015 16:19:09 -0700
changeset 25761 0d37b9b21467
parent 25495 c63bf97cf7c7
child 33286 2428e8ec0793
permissions -rw-r--r--
hg: support for auto sharing stores when cloning Many 3rd party consumers of Mercurial have created wrappers to essentially perform clone+share as a single operation. This is especially popular in automated processes like continuous integration systems. The Jenkins CI software and Mozilla's Firefox release automation infrastructure have both implemented custom code that effectively perform clone+share. The common use case here is that clients want to obtain N>1 checkouts while minimizing disk space and network requirements. Furthermore, they often don't care that a clone is an exact mirror of a remote: they are simply looking to obtain checkouts of specific revisions. When multiple third parties implement a similar feature, it's a good sign that the feature is worth adding to the core product. This patch adds support for an easy-to-use clone+share feature. The internal "clone" function now accepts options to control auto sharing during clone. When the auto share mode is active, a store will be created/updated under the base directory specified and a new repository pointing to the shared store will be created at the path specified by the user. The share extension has grown the ability to pass these options into the clone command/function. No command line options for this feature are added because we don't feel the feature will be popular enough to warrant their existence. There are two modes for auto share mode. In the default mode, the shared repo is derived from the first changeset (rev 0) in the remote repository. This enables related repositories existing at different URLs to automatically use the same storage. In environments that operate several repositories (separate repo for branch/head/bookmark or separate repo per user), this has the potential to drastically reduce storage and network requirements. In the other mode, the name is derived from the remote's path/URL.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 17539
diff changeset
     1
#require killdaemons
15446
c5c9ca3719f9 tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents: 14281
diff changeset
     2
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
     3
Preparing the subrepository 'sub'
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
     4
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
     5
  $ hg init sub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
     6
  $ echo sub > sub/sub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
     7
  $ hg add -R sub
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 15446
diff changeset
     8
  adding sub/sub (glob)
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
     9
  $ hg commit -R sub -m "sub import"
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    10
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    11
Preparing the 'main' repo which depends on the subrepo 'sub'
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
    12
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    13
  $ hg init main
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    14
  $ echo main > main/main
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    15
  $ echo "sub = ../sub" > main/.hgsub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    16
  $ hg clone sub main/sub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    17
  updating to branch default
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    18
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    19
  $ hg add -R main
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 15446
diff changeset
    20
  adding main/.hgsub (glob)
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 15446
diff changeset
    21
  adding main/main (glob)
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    22
  $ hg commit -R main -m "main import"
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    23
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    24
Cleaning both repositories, just as a clone -U
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    25
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    26
  $ hg up -C -R sub null
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    27
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    28
  $ hg up -C -R main null
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    29
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    30
  $ rm -rf main/sub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    31
17015
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 16351
diff changeset
    32
hide outer repo
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 16351
diff changeset
    33
  $ hg init
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 16351
diff changeset
    34
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    35
Serving them both using hgweb
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
    36
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    37
  $ printf '[paths]\n/main = main\nsub = sub\n' > webdir.conf
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    38
  $ hg serve --webdir-conf webdir.conf -a localhost -p $HGPORT \
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    39
  >    -A /dev/null -E /dev/null --pid-file hg.pid -d
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    40
  $ cat hg.pid >> $DAEMON_PIDS
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
    41
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    42
Clone main from hgweb
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
    43
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    44
  $ hg clone "http://localhost:$HGPORT/main" cloned
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    45
  requesting all changes
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    46
  adding changesets
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    47
  adding manifests
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    48
  adding file changes
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    49
  added 1 changesets with 3 changes to 3 files
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    50
  updating to branch default
14281
ccb7240acf32 subrepo: create subrepos using clone instead of pull
Martin Geisler <mg@aragost.com>
parents: 14187
diff changeset
    51
  cloning subrepo sub from http://localhost:$HGPORT/sub
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    52
  requesting all changes
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    53
  adding changesets
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    54
  adding manifests
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    55
  adding file changes
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    56
  added 1 changesets with 1 changes to 1 files
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    57
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
    58
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    59
Checking cloned repo ids
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    60
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    61
  $ hg id -R cloned
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    62
  fdfeeb3e979e tip
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    63
  $ hg id -R cloned/sub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    64
  863c1745b441 tip
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    65
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    66
subrepo debug for 'main' clone
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
    67
11915
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    68
  $ hg debugsub -R cloned
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    69
  path sub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    70
   source   ../sub
d521e72314f9 tests: unify test-subrepo-relative-path
Martin Geisler <mg@lazybytes.net>
parents: 11109
diff changeset
    71
   revision 863c1745b441bd97a8c4a096e87793073f4fb215
11109
a2bc2f2d77a9 subrepo: normalize path part of URLs so that pulling subrepos from webdir works
Edouard Gomez <ed.gomez@free.fr>
parents:
diff changeset
    72
25474
8c14f87bd0ae tests: drop DAEMON_PIDS from killdaemons calls
Matt Mackall <mpm@selenic.com>
parents: 25472
diff changeset
    73
  $ killdaemons.py
14187
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    74
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    75
subrepo paths with ssh urls
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    76
25495
c63bf97cf7c7 tests: restore 'python' and '$TESTDIR/' for dummyssh invocation
Matt Harbison <matt_harbison@yahoo.com>
parents: 25476
diff changeset
    77
  $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/cloned sshclone
14187
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    78
  requesting all changes
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    79
  adding changesets
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    80
  adding manifests
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    81
  adding file changes
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    82
  added 1 changesets with 3 changes to 3 files
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    83
  updating to branch default
14281
ccb7240acf32 subrepo: create subrepos using clone instead of pull
Martin Geisler <mg@aragost.com>
parents: 14187
diff changeset
    84
  cloning subrepo sub from ssh://user@dummy/sub
14187
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    85
  requesting all changes
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    86
  adding changesets
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    87
  adding manifests
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    88
  adding file changes
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    89
  added 1 changesets with 1 changes to 1 files
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    90
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    91
25495
c63bf97cf7c7 tests: restore 'python' and '$TESTDIR/' for dummyssh invocation
Matt Harbison <matt_harbison@yahoo.com>
parents: 25476
diff changeset
    92
  $ hg -R sshclone push -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/cloned
14187
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    93
  pushing to ssh://user@dummy/$TESTTMP/cloned
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    94
  pushing subrepo sub to ssh://user@dummy/$TESTTMP/sub
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    95
  searching for changes
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    96
  no changes found
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    97
  searching for changes
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
    98
  no changes found
16023
90f8b8dd0326 push: return 1 if no changes found (issue3228)
Matt Mackall <mpm@selenic.com>
parents: 15622
diff changeset
    99
  [1]
14187
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
   100
9bbaafddfa90 tests: test subrepos with ssh urls
Mads Kiilerich <mads@kiilerich.com>
parents: 13138
diff changeset
   101
  $ cat dummylog
15622
86fc364ca5f8 sshrepo: don't quote obviously safe strings (issue2983)
Mads Kiilerich <mads@kiilerich.com>
parents: 15581
diff changeset
   102
  Got arguments 1:user@dummy 2:hg -R cloned serve --stdio
86fc364ca5f8 sshrepo: don't quote obviously safe strings (issue2983)
Mads Kiilerich <mads@kiilerich.com>
parents: 15581
diff changeset
   103
  Got arguments 1:user@dummy 2:hg -R sub serve --stdio
86fc364ca5f8 sshrepo: don't quote obviously safe strings (issue2983)
Mads Kiilerich <mads@kiilerich.com>
parents: 15581
diff changeset
   104
  Got arguments 1:user@dummy 2:hg -R $TESTTMP/cloned serve --stdio
86fc364ca5f8 sshrepo: don't quote obviously safe strings (issue2983)
Mads Kiilerich <mads@kiilerich.com>
parents: 15581
diff changeset
   105
  Got arguments 1:user@dummy 2:hg -R $TESTTMP/sub serve --stdio