| 1 |
#require rhg |
| 2 |
|
| 3 |
$ NO_FALLBACK="env RHG_ON_UNSUPPORTED=abort" |
| 4 |
|
| 5 |
Rhg works well when sparse working copy is enabled. |
| 6 |
|
| 7 |
$ cd "$TESTTMP" |
| 8 |
$ hg init repo-sparse |
| 9 |
$ cd repo-sparse |
| 10 |
$ cat > .hg/hgrc <<EOF |
| 11 |
> [extensions] |
| 12 |
> sparse= |
| 13 |
> EOF |
| 14 |
|
| 15 |
$ echo a > show |
| 16 |
$ echo x > hide |
| 17 |
$ mkdir dir1 dir2 |
| 18 |
$ echo x > dir1/x |
| 19 |
$ echo y > dir1/y |
| 20 |
$ echo z > dir2/z |
| 21 |
|
| 22 |
$ hg ci -Aqm 'initial' |
| 23 |
$ hg debugsparse --include 'show' |
| 24 |
$ ls -A |
| 25 |
.hg |
| 26 |
show |
| 27 |
|
| 28 |
$ tip=$(hg log -r . --template '{node}') |
| 29 |
$ $NO_FALLBACK rhg files -r "$tip" |
| 30 |
dir1/x |
| 31 |
dir1/y |
| 32 |
dir2/z |
| 33 |
hide |
| 34 |
show |
| 35 |
$ $NO_FALLBACK rhg files |
| 36 |
show |
| 37 |
|
| 38 |
$ $NO_FALLBACK rhg cat -r "$tip" hide |
| 39 |
x |
| 40 |
|
| 41 |
$ cd .. |
| 42 |
|
| 43 |
We support most things when narrow is enabled, too, with a couple of caveats. |
| 44 |
|
| 45 |
$ . "$TESTDIR/narrow-library.sh" |
| 46 |
$ real_hg=$RHG_FALLBACK_EXECUTABLE |
| 47 |
|
| 48 |
$ cat >> $HGRCPATH <<EOF |
| 49 |
> [extensions] |
| 50 |
> narrow= |
| 51 |
> EOF |
| 52 |
|
| 53 |
$ hg clone --narrow ./repo-sparse repo-narrow --include dir1 |
| 54 |
requesting all changes |
| 55 |
adding changesets |
| 56 |
adding manifests |
| 57 |
adding file changes |
| 58 |
added 1 changesets with 2 changes to 2 files |
| 59 |
new changesets 6d714a4a2998 |
| 60 |
updating to branch default |
| 61 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 62 |
|
| 63 |
$ cd repo-narrow |
| 64 |
|
| 65 |
$ $NO_FALLBACK rhg cat -r "$tip" dir1/x |
| 66 |
x |
| 67 |
$ "$real_hg" cat -r "$tip" dir1/x |
| 68 |
x |
| 69 |
|
| 70 |
TODO: bad error message |
| 71 |
|
| 72 |
$ $NO_FALLBACK rhg cat -r "$tip" hide |
| 73 |
abort: invalid revision identifier: 1406e74118627694268417491f018a4a883152f0 |
| 74 |
[255] |
| 75 |
$ "$real_hg" cat -r "$tip" hide |
| 76 |
[1] |
| 77 |
|
| 78 |
A naive implementation of `rhg files` would leak the paths that are supposed |
| 79 |
to be hidden by narrow. |
| 80 |
|
| 81 |
$ $NO_FALLBACK rhg files -r "$tip" |
| 82 |
dir1/x |
| 83 |
dir1/y |
| 84 |
$ "$real_hg" files -r "$tip" |
| 85 |
dir1/x |
| 86 |
dir1/y |
| 87 |
|
| 88 |
The working copy version works with narrow correctly |
| 89 |
|
| 90 |
$ $NO_FALLBACK rhg files |
| 91 |
dir1/x |
| 92 |
dir1/y |
| 93 |
$ "$real_hg" files |
| 94 |
dir1/x |
| 95 |
dir1/y |
| 96 |
|
| 97 |
Hg status needs to do some filtering based on narrow spec |
| 98 |
|
| 99 |
$ mkdir dir2 |
| 100 |
$ touch dir2/q |
| 101 |
$ "$real_hg" status |
| 102 |
$ $NO_FALLBACK rhg --config rhg.status=true status |
| 103 |
|
| 104 |
Adding "orphaned" index files: |
| 105 |
|
| 106 |
$ (cd ..; cp repo-sparse/.hg/store/data/hide.i repo-narrow/.hg/store/data/hide.i) |
| 107 |
$ (cd ..; mkdir repo-narrow/.hg/store/data/dir2; cp repo-sparse/.hg/store/data/dir2/z.i repo-narrow/.hg/store/data/dir2/z.i) |
| 108 |
$ "$real_hg" verify -q |
| 109 |
|
| 110 |
$ "$real_hg" files -r "$tip" |
| 111 |
dir1/x |
| 112 |
dir1/y |
| 113 |
|
| 114 |
# TODO: even though [hg files] hides the orphaned dir2/z, [hg cat] still shows it. |
| 115 |
# rhg has the same issue, but at least it's not specific to rhg. |
| 116 |
# This is despite [hg verify] succeeding above. |
| 117 |
|
| 118 |
$ $NO_FALLBACK rhg cat -r "$tip" dir2/z |
| 119 |
z |
| 120 |
$ "$real_hg" cat -r "$tip" dir2/z |
| 121 |
z |