tests/test-narrow-commit.t
author Martin von Zweigbergk <martinvonz@google.com>
Sat, 13 Apr 2019 00:24:17 -0700
changeset 42203 7815cf0ea88b
parent 40816 3984409e144b
child 47875 cc33deae66a1
permissions -rw-r--r--
tests: add test for issue5343 (grafting with copies) It seems that issue5353 resulted in a lot of tests in test-graft.t, but the bug actually reported in that issue didn't get a test case. This patch adds one for the "move" and one for the "copy" version of it. I also added a "copy+modify" case, to show what should be a merge conflict. I didn't add one for the "backwards" version of it since the comment says that that was already covered by previous work. The tests added by this patch show the broken behavior (the bug is still open). I suspect the results returned from mergecopies() are not expressive enough to fix this issue: it has a dict for copies to merge with, but that can only give one more filename, but here we need two (one for the path on the remote side and one for the path in the merge base). I want to have it tested anyway since I'm about to refactor mergecopies(). Differential Revision: https://phab.mercurial-scm.org/D6242
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36122
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
     1
#testcases flat tree
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
     2
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
  $ . "$TESTDIR/narrow-library.sh"
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
     4
36122
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
     5
#if tree
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
     6
  $ cat << EOF >> $HGRCPATH
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
     7
  > [experimental]
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
     8
  > treemanifest = 1
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
     9
  > EOF
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
    10
#endif
dc01484606da tests: fold narrow treemanifest tests into main test file using testcases
Augie Fackler <augie@google.com>
parents: 36117
diff changeset
    11
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
create full repo
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    13
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    14
  $ hg init master
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    15
  $ cd master
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    16
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    17
  $ mkdir inside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    18
  $ echo inside > inside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    19
  $ mkdir outside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    20
  $ echo outside > outside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    21
  $ hg ci -Aqm 'initial'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    22
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    23
  $ echo modified > inside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    24
  $ hg ci -qm 'modify inside'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    25
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    26
  $ echo modified > outside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    27
  $ hg ci -qm 'modify outside'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    28
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    29
  $ cd ..
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    30
37141
4d63f3bc1e1a lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794)
Matt Harbison <matt_harbison@yahoo.com>
parents: 36248
diff changeset
    31
(The lfs extension does nothing here, but this test ensures that its hook that
4d63f3bc1e1a lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794)
Matt Harbison <matt_harbison@yahoo.com>
parents: 36248
diff changeset
    32
determines whether to add the lfs requirement, respects the narrow boundaries.)
4d63f3bc1e1a lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794)
Matt Harbison <matt_harbison@yahoo.com>
parents: 36248
diff changeset
    33
4d63f3bc1e1a lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794)
Matt Harbison <matt_harbison@yahoo.com>
parents: 36248
diff changeset
    34
  $ hg --config extensions.lfs= clone --narrow ssh://user@dummy/master narrow \
4d63f3bc1e1a lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794)
Matt Harbison <matt_harbison@yahoo.com>
parents: 36248
diff changeset
    35
  >    --include inside
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    36
  requesting all changes
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    37
  adding changesets
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    38
  adding manifests
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    39
  adding file changes
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    40
  added 3 changesets with 2 changes to 1 files
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    41
  new changesets *:* (glob)
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    42
  updating to branch default
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    43
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    44
  $ cd narrow
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    45
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    46
  $ hg update -q 0
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    47
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    48
Can not modify dirstate outside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    49
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    50
  $ mkdir outside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    51
  $ touch outside/f1
38274
7c3a59e2971b debugwalk: show matcher output only if -v/--verbose
Yuya Nishihara <yuya@tcha.org>
parents: 37141
diff changeset
    52
  $ hg debugwalk -v -I 'relglob:f1'
38275
dbf31732ef64 debugwalk: pretty-print nested matcher
Yuya Nishihara <yuya@tcha.org>
parents: 38274
diff changeset
    53
  * matcher:
40816
3984409e144b match: drop unnecessary wrapping of regex in group
Martin von Zweigbergk <martinvonz@google.com>
parents: 40085
diff changeset
    54
  <includematcher includes='(?:|.*/)f1(?:/|$)'>
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    55
  f  inside/f1  inside/f1
39941
277a6fb460a6 tests: add test showing that paths outside narrowspec are not added
Martin von Zweigbergk <martinvonz@google.com>
parents: 39776
diff changeset
    56
  $ hg add .
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    57
  $ hg add outside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    58
  abort: cannot track 'outside/f1' - it is outside the narrow clone
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    59
  [255]
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    60
  $ touch outside/f3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    61
  $ hg add outside/f3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    62
  abort: cannot track 'outside/f3' - it is outside the narrow clone
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    63
  [255]
36238
deb851914fd7 dirstate: drop explicit files that shouldn't match (BC) (issue4679)
Yuya Nishihara <yuya@tcha.org>
parents: 36122
diff changeset
    64
deb851914fd7 dirstate: drop explicit files that shouldn't match (BC) (issue4679)
Yuya Nishihara <yuya@tcha.org>
parents: 36122
diff changeset
    65
But adding a truly excluded file shouldn't count
deb851914fd7 dirstate: drop explicit files that shouldn't match (BC) (issue4679)
Yuya Nishihara <yuya@tcha.org>
parents: 36122
diff changeset
    66
deb851914fd7 dirstate: drop explicit files that shouldn't match (BC) (issue4679)
Yuya Nishihara <yuya@tcha.org>
parents: 36122
diff changeset
    67
  $ hg add outside/f3 -X outside/f3
deb851914fd7 dirstate: drop explicit files that shouldn't match (BC) (issue4679)
Yuya Nishihara <yuya@tcha.org>
parents: 36122
diff changeset
    68
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    69
  $ rm -r outside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    70
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    71
Can modify dirstate inside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    72
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    73
  $ echo modified > inside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    74
  $ touch inside/f3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    75
  $ hg add inside/f3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    76
  $ hg status
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    77
  M inside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    78
  A inside/f3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    79
  $ hg revert -qC .
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    80
  $ rm inside/f3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    81
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    82
Can commit changes inside. Leaves outside unchanged.
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    83
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    84
  $ hg update -q 'desc("initial")'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    85
  $ echo modified2 > inside/f1
36248
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    86
  $ hg manifest --debug
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    87
  4d6a634d5ba06331a60c29ee0db8412490a54fcd 644   inside/f1
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    88
  7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644   outside/f1 (flat !)
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    89
  d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !)
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    90
  $ hg commit -m 'modify inside/f1'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    91
  created new head
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    92
  $ hg files -r .
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    93
  inside/f1
36248
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    94
  $ hg manifest --debug
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    95
  3f4197b4a11b9016e77ebc47fe566944885fd11b 644   inside/f1
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    96
  7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644   outside/f1 (flat !)
5c9bdfb32eac manifest: add support for including directories outside narrowspec
Martin von Zweigbergk <martinvonz@google.com>
parents: 36238
diff changeset
    97
  d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !)
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    98
Some filesystems (notably FAT/exFAT only store timestamps with 2
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
    99
seconds of precision, so by sleeping for 3 seconds, we can ensure that
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
   100
the timestamps of files stored by dirstate will appear older than the
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
   101
dirstate file, and therefore we'll be able to get stable output from
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
   102
debugdirstate. If we don't do this, the test can be slightly flaky.
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
   103
  $ sleep 3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
   104
  $ hg status
39776
7e99b02768ef debugdirstate: deprecate --nodates in favor of --no-dates
Martin von Zweigbergk <martinvonz@google.com>
parents: 38275
diff changeset
   105
  $ hg debugdirstate --no-dates
36117
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
   106
  n 644         10 set                 inside/f1