| 1 |
#testcases flat tree |
| 2 |
|
| 3 |
$ . "$TESTDIR/narrow-library.sh" |
| 4 |
|
| 5 |
#if tree |
| 6 |
$ cat << EOF >> $HGRCPATH |
| 7 |
> [experimental] |
| 8 |
> treemanifest = 1 |
| 9 |
> EOF |
| 10 |
#endif |
| 11 |
|
| 12 |
create full repo |
| 13 |
|
| 14 |
$ hg init master |
| 15 |
$ cd master |
| 16 |
|
| 17 |
$ mkdir inside |
| 18 |
$ echo inside > inside/f1 |
| 19 |
$ mkdir outside |
| 20 |
$ echo outside > outside/f1 |
| 21 |
$ hg ci -Aqm 'initial' |
| 22 |
|
| 23 |
$ echo modified > inside/f1 |
| 24 |
$ hg ci -qm 'modify inside' |
| 25 |
|
| 26 |
$ echo modified > outside/f1 |
| 27 |
$ hg ci -qm 'modify outside' |
| 28 |
|
| 29 |
$ cd .. |
| 30 |
|
| 31 |
(The lfs extension does nothing here, but this test ensures that its hook that |
| 32 |
determines whether to add the lfs requirement, respects the narrow boundaries.) |
| 33 |
|
| 34 |
$ hg --config extensions.lfs= clone --narrow ssh://user@dummy/master narrow \ |
| 35 |
> --include inside |
| 36 |
requesting all changes |
| 37 |
adding changesets |
| 38 |
adding manifests |
| 39 |
adding file changes |
| 40 |
added 3 changesets with 2 changes to 1 files |
| 41 |
new changesets *:* (glob) |
| 42 |
updating to branch default |
| 43 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 44 |
$ cd narrow |
| 45 |
|
| 46 |
$ hg update -q 0 |
| 47 |
|
| 48 |
Can not modify dirstate outside |
| 49 |
|
| 50 |
$ mkdir outside |
| 51 |
$ touch outside/f1 |
| 52 |
$ hg debugwalk -v -I 'relglob:f1' |
| 53 |
* matcher: |
| 54 |
<includematcher includes='(?:|.*/)f1(?:/|$)'> |
| 55 |
f inside/f1 inside/f1 |
| 56 |
$ hg add . |
| 57 |
$ hg add outside/f1 |
| 58 |
abort: cannot track 'outside/f1' - it is outside the narrow clone |
| 59 |
[255] |
| 60 |
$ touch outside/f3 |
| 61 |
$ hg add outside/f3 |
| 62 |
abort: cannot track 'outside/f3' - it is outside the narrow clone |
| 63 |
[255] |
| 64 |
|
| 65 |
But adding a truly excluded file shouldn't count |
| 66 |
|
| 67 |
$ hg add outside/f3 -X outside/f3 |
| 68 |
|
| 69 |
$ rm -r outside |
| 70 |
|
| 71 |
Can modify dirstate inside |
| 72 |
|
| 73 |
$ echo modified > inside/f1 |
| 74 |
$ touch inside/f3 |
| 75 |
$ hg add inside/f3 |
| 76 |
$ hg status |
| 77 |
M inside/f1 |
| 78 |
A inside/f3 |
| 79 |
$ hg revert -qC . |
| 80 |
$ rm inside/f3 |
| 81 |
|
| 82 |
Can commit changes inside. Leaves outside unchanged. |
| 83 |
|
| 84 |
$ hg update -q 'desc("initial")' |
| 85 |
$ echo modified2 > inside/f1 |
| 86 |
$ hg manifest --debug |
| 87 |
4d6a634d5ba06331a60c29ee0db8412490a54fcd 644 inside/f1 |
| 88 |
7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !) |
| 89 |
d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !) |
| 90 |
$ hg commit -m 'modify inside/f1' |
| 91 |
created new head |
| 92 |
$ hg files -r . |
| 93 |
inside/f1 |
| 94 |
$ hg manifest --debug |
| 95 |
3f4197b4a11b9016e77ebc47fe566944885fd11b 644 inside/f1 |
| 96 |
7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !) |
| 97 |
d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !) |
| 98 |
Some filesystems (notably FAT/exFAT only store timestamps with 2 |
| 99 |
seconds of precision, so by sleeping for 3 seconds, we can ensure that |
| 100 |
the timestamps of files stored by dirstate will appear older than the |
| 101 |
dirstate file, and therefore we'll be able to get stable output from |
| 102 |
debugdirstate. If we don't do this, the test can be slightly flaky. |
| 103 |
$ sleep 3 |
| 104 |
$ hg status |
| 105 |
$ hg debugdirstate --no-dates |
| 106 |
n 644 10 set inside/f1 |
| 107 |
|
| 108 |
Can commit empty files |
| 109 |
|
| 110 |
$ touch inside/c; hg add inside/c; hg commit -qm _; hg verify -q |
| 111 |
$ hg cat -r . inside/c |