tests/test-narrow-share.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 19 Feb 2022 18:42:12 -0700
changeset 48938 4561ec90d3c1
parent 48242 7ed0fc687220
child 49920 2f2682f40ea0
permissions -rw-r--r--
automation: delete code related to Python 2.7 support The building of Inno and WiX installers took a python_version argument that allowed us to specify "2" or "3" for the major Python version. Since we no longer support Python 2, we can delete this argument and everything feeding into it. Differential Revision: https://phab.mercurial-scm.org/D12264
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     1
#testcases flat tree
45494
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 42213
diff changeset
     2
#testcases safe normal
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 42213
diff changeset
     3
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 42213
diff changeset
     4
#if safe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 42213
diff changeset
     5
  $ echo "[format]"         >> $HGRCPATH
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 42213
diff changeset
     6
  $ echo "exp-share-safe = True" >> $HGRCPATH
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 42213
diff changeset
     7
#endif
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     8
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     9
  $ . "$TESTDIR/narrow-library.sh"
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    10
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    11
#if tree
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    12
  $ cat << EOF >> $HGRCPATH
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    13
  > [experimental]
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    14
  > treemanifest = 1
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    15
  > EOF
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    16
#endif
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    17
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    18
  $ cat << EOF >> $HGRCPATH
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    19
  > [extensions]
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    20
  > share =
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    21
  > EOF
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    22
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    23
  $ hg init remote
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    24
  $ cd remote
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    25
  $ for x in `$TESTDIR/seq.py 0 10`
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    26
  > do
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    27
  >   mkdir d$x
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    28
  >   echo $x > d$x/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    29
  >   hg add d$x/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    30
  >   hg commit -m "add d$x/f"
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    31
  > done
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    32
  $ cd ..
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    33
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    34
  $ hg clone --narrow ssh://user@dummy/remote main -q \
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    35
  > --include d1 --include d3 --include d5 --include d7
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    36
42213
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
    37
Ignore file called "ignored"
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
    38
  $ echo ignored > main/.hgignore
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
    39
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    40
  $ hg share main share
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    41
  updating working directory
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    42
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    43
  $ hg -R share tracked
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    44
  I path:d1
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    45
  I path:d3
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    46
  I path:d5
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    47
  I path:d7
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    48
  $ hg -R share files
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    49
  share/d1/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    50
  share/d3/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    51
  share/d5/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    52
  share/d7/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    53
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    54
Narrow the share and check that the main repo's working copy gets updated
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    55
41181
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    56
# Make sure the files that are supposed to be known-clean get their timestamps set in the dirstate
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    57
  $ sleep 2
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    58
  $ hg -R main st
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    59
  $ hg -R main debugdirstate --no-dates
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    60
  n 644          2 set                 d1/f
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    61
  n 644          2 set                 d3/f
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    62
  n 644          2 set                 d5/f
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    63
  n 644          2 set                 d7/f
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    64
# Make d3/f dirty
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    65
  $ echo x >> main/d3/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    66
  $ echo y >> main/d3/g
42213
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
    67
  $ touch main/d3/ignored
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
    68
  $ touch main/d3/untracked
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    69
  $ hg add main/d3/g
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    70
  $ hg -R main st
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    71
  M d3/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    72
  A d3/g
42213
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
    73
  ? d3/untracked
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    74
# Make d5/f not match the dirstate timestamp even though it's clean
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    75
  $ sleep 2
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    76
  $ hg -R main st
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    77
  M d3/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    78
  A d3/g
42213
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
    79
  ? d3/untracked
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    80
  $ hg -R main debugdirstate --no-dates
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    81
  n 644          2 set                 d1/f
41181
3227923979a1 tests: de-flake test-narrow-share.t by making dirstate predictable
Martin von Zweigbergk <martinvonz@google.com>
parents: 41046
diff changeset
    82
  n 644          2 set                 d3/f
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    83
  a   0         -1 unset               d3/g
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    84
  n 644          2 set                 d5/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    85
  n 644          2 set                 d7/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    86
  $ touch main/d5/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    87
  $ hg -R share tracked --removeinclude d1 --removeinclude d3 --removeinclude d5
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    88
  comparing with ssh://user@dummy/remote
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    89
  searching for changes
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    90
  looking for local changes to affected paths
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    91
  deleting data/d1/f.i
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    92
  deleting data/d3/f.i
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    93
  deleting data/d5/f.i
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    94
  deleting meta/d1/00manifest.i (tree !)
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    95
  deleting meta/d3/00manifest.i (tree !)
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    96
  deleting meta/d5/00manifest.i (tree !)
47067
20eba5cef2e0 narrow: add more status messages when narrowing
Martin von Zweigbergk <martinvonz@google.com>
parents: 45494
diff changeset
    97
  deleting unwanted files from working copy
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    98
  $ hg -R main tracked
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    99
  I path:d7
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   100
  $ hg -R main files
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   101
  abort: working copy's narrowspec is stale
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   102
  (run 'hg tracked --update-working-copy')
48242
7ed0fc687220 narrow: raise StateError when working copy is stale (for detailed exit code)
Martin von Zweigbergk <martinvonz@google.com>
parents: 47067
diff changeset
   103
  [20]
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   104
  $ hg -R main tracked --update-working-copy
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   105
  not deleting possibly dirty file d3/f
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   106
  not deleting possibly dirty file d3/g
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   107
  not deleting possibly dirty file d5/f
42213
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
   108
  not deleting unknown file d3/untracked
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
   109
  not deleting ignored file d3/ignored
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   110
# d1/f, d3/f, d3/g and d5/f should no longer be reported
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   111
  $ hg -R main files
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   112
  main/d7/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   113
# d1/f should no longer be there, d3/f should be since it was dirty, d3/g should be there since
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   114
# it was added, and d5/f should be since we couldn't be sure it was clean
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   115
  $ find main/d* -type f | sort
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   116
  main/d3/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   117
  main/d3/g
42213
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
   118
  main/d3/ignored
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
   119
  main/d3/untracked
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   120
  main/d5/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   121
  main/d7/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   122
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   123
Widen the share and check that the main repo's working copy gets updated
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   124
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   125
  $ hg -R share tracked --addinclude d1 --addinclude d3 -q
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   126
  $ hg -R share tracked
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   127
  I path:d1
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   128
  I path:d3
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   129
  I path:d7
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   130
  $ hg -R share files
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   131
  share/d1/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   132
  share/d3/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   133
  share/d7/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   134
  $ hg -R main tracked
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   135
  I path:d1
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   136
  I path:d3
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   137
  I path:d7
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   138
  $ hg -R main files
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   139
  abort: working copy's narrowspec is stale
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   140
  (run 'hg tracked --update-working-copy')
48242
7ed0fc687220 narrow: raise StateError when working copy is stale (for detailed exit code)
Martin von Zweigbergk <martinvonz@google.com>
parents: 47067
diff changeset
   141
  [20]
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   142
  $ hg -R main tracked --update-working-copy
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   143
# d1/f, d3/f should be back
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   144
  $ hg -R main files
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   145
  main/d1/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   146
  main/d3/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   147
  main/d7/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   148
# d3/f should be modified (not clobbered by the widening), and d3/g should be untracked
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   149
  $ hg -R main st --all
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   150
  M d3/f
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   151
  ? d3/g
42213
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
   152
  ? d3/untracked
84bd6ae2d1f6 narrow: also warn when not deleting untracked or ignored files
Martin von Zweigbergk <martinvonz@google.com>
parents: 41298
diff changeset
   153
  I d3/ignored
41045
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   154
  C d1/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   155
  C d7/f
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   156
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   157
We should also be able to unshare without breaking everything:
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   158
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   159
  $ hg share main share-unshare
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   160
  updating working directory
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   161
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   162
  $ cd share-unshare
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   163
  $ hg unshare
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   164
  $ hg verify
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   165
  checking changesets
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   166
  checking manifests
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   167
  checking directory manifests (tree !)
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   168
  crosschecking files in changesets and manifests
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   169
  checking files
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   170
  checked 11 changesets with 3 changes to 3 files
7db1619af061 tests: add test for narrow+share
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   171
  $ cd ..
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   172
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   173
Dirstate should be left alone when upgrading from version of hg that didn't support narrow+share
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   174
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   175
  $ hg share main share-upgrade
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   176
  updating working directory
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   177
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   178
  $ cd share-upgrade
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   179
  $ echo x >> d1/f
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   180
  $ echo y >> d3/g
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   181
  $ hg add d3/g
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   182
  $ hg rm d7/f
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   183
  $ hg st
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   184
  M d1/f
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   185
  A d3/g
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   186
  R d7/f
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   187
Make it look like a repo from before narrow+share was supported
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   188
  $ rm .hg/narrowspec.dirstate
41298
88a7c211b21e narrow: fix crash when restoring backup in legacy repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 41181
diff changeset
   189
  $ hg ci -Am test
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   190
  abort: working copy's narrowspec is stale
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   191
  (run 'hg tracked --update-working-copy')
48242
7ed0fc687220 narrow: raise StateError when working copy is stale (for detailed exit code)
Martin von Zweigbergk <martinvonz@google.com>
parents: 47067
diff changeset
   192
  [20]
41046
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   193
  $ hg tracked --update-working-copy
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   194
  $ hg st
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   195
  M d1/f
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   196
  A d3/g
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   197
  R d7/f
ce0bc2952e2a narrow: detect if narrowspec was changed in a different share
Martin von Zweigbergk <martinvonz@google.com>
parents: 41045
diff changeset
   198
  $ cd ..