Debian Codegraph @

tests/test-narrow-pull.t

raw
1 $ . "$TESTDIR/narrow-library.sh"
2
3 $ hg init master
4 $ cd master
5 $ cat >> .hg/hgrc <<EOF
6 > [narrow]
7 > serveellipses=True
8 > EOF
9 $ for x in `$TESTDIR/seq.py 10`
10 > do
11 > echo $x > "f$x"
12 > hg add "f$x"
13 > hg commit -m "Commit f$x"
14 > done
15 $ cd ..
16
17 narrow clone a couple files, f2 and f8
18
19 $ hg clone --narrow ssh://user@dummy/master narrow --include "f2" --include "f8"
20 requesting all changes
21 adding changesets
22 adding manifests
23 adding file changes
24 added 5 changesets with 2 changes to 2 files
25 new changesets *:* (glob)
26 updating to branch default
27 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 $ cd narrow
29 $ ls -A
30 .hg
31 f2
32 f8
33 $ cat f2 f8
34 2
35 8
36
37 $ cd ..
38
39 change every upstream file twice
40
41 $ cd master
42 $ for x in `$TESTDIR/seq.py 10`
43 > do
44 > echo "update#1 $x" >> "f$x"
45 > hg commit -m "Update#1 to f$x" "f$x"
46 > done
47 $ for x in `$TESTDIR/seq.py 10`
48 > do
49 > echo "update#2 $x" >> "f$x"
50 > hg commit -m "Update#2 to f$x" "f$x"
51 > done
52 $ cd ..
53
54 look for incoming changes
55
56 $ cd narrow
57 $ hg incoming --limit 3
58 comparing with ssh://user@dummy/master
59 searching for changes
60 changeset: 5:ddc055582556
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: Update#1 to f1
64
65 changeset: 6:f66eb5ad621d
66 user: test
67 date: Thu Jan 01 00:00:00 1970 +0000
68 summary: Update#1 to f2
69
70 changeset: 7:c42ecff04e99
71 user: test
72 date: Thu Jan 01 00:00:00 1970 +0000
73 summary: Update#1 to f3
74
75
76 Interrupting the pull is safe
77 $ hg --config hooks.pretxnchangegroup.bad=false pull -q
78 transaction abort!
79 rollback completed
80 abort: pretxnchangegroup.bad hook exited with status 1
81 [40]
82 $ hg id
83 223311e70a6f tip
84
85 pull new changes down to the narrow clone. Should get 8 new changesets: 4
86 relevant to the narrow spec, and 4 ellipsis nodes gluing them all together.
87
88 $ hg pull
89 pulling from ssh://user@dummy/master
90 searching for changes
91 adding changesets
92 adding manifests
93 adding file changes
94 added 9 changesets with 4 changes to 2 files
95 new changesets *:* (glob)
96 (run 'hg update' to get a working copy)
97 $ hg log -T '{rev}: {desc}\n'
98 13: Update#2 to f10
99 12: Update#2 to f8
100 11: Update#2 to f7
101 10: Update#2 to f2
102 9: Update#2 to f1
103 8: Update#1 to f8
104 7: Update#1 to f7
105 6: Update#1 to f2
106 5: Update#1 to f1
107 4: Commit f10
108 3: Commit f8
109 2: Commit f7
110 1: Commit f2
111 0: Commit f1
112 $ hg update tip
113 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
114
115 add a change and push it
116
117 $ echo "update#3 2" >> f2
118 $ hg commit -m "Update#3 to f2" f2
119 $ hg log f2 -T '{rev}: {desc}\n'
120 14: Update#3 to f2
121 10: Update#2 to f2
122 6: Update#1 to f2
123 1: Commit f2
124 $ hg push
125 pushing to ssh://user@dummy/master
126 searching for changes
127 remote: adding changesets
128 remote: adding manifests
129 remote: adding file changes
130 remote: added 1 changesets with 1 changes to 1 files
131 $ cd ..
132
133 $ cd master
134 $ hg log f2 -T '{rev}: {desc}\n'
135 30: Update#3 to f2
136 21: Update#2 to f2
137 11: Update#1 to f2
138 1: Commit f2
139 $ hg log -l 3 -T '{rev}: {desc}\n'
140 30: Update#3 to f2
141 29: Update#2 to f10
142 28: Update#2 to f9
143
144 Can pull into repo with a single commit
145
146 $ cd ..
147 $ hg clone -q --narrow ssh://user@dummy/master narrow2 --include "f1" -r 0
148 $ cd narrow2
149 $ hg pull -q -r 1
150 remote: abort: unexpected error: unable to resolve parent while packing '00manifest' 1 for changeset 0
151 transaction abort!
152 rollback completed
153 abort: pull failed on remote
154 [100]