##// END OF EJS Templates
tests: convert some 'hghave execbit' to #if...
Mads Kiilerich -
r16899:8149ff40 default
parent child Browse files
Show More
@@ -1,284 +1,287 b''
1 $ "$TESTDIR/hghave" symlink execbit || exit 80
2
3 1 $ . "$TESTDIR/bzr-definitions"
4 2
5 3 create and rename on the same file in the same step
6 4
7 5 $ mkdir test-createandrename
8 6 $ cd test-createandrename
9 7 $ bzr init -q source
10 8
11 9 test empty repo conversion (issue3233)
12 10
13 11 $ hg convert source source-hg
14 12 initializing destination source-hg repository
15 13 scanning source...
16 14 sorting...
17 15 converting...
18 16
19 17 back to the rename stuff
20 18
21 19 $ cd source
22 20 $ echo a > a
23 21 $ echo c > c
24 22 $ echo e > e
25 23 $ bzr add -q a c e
26 24 $ bzr commit -q -m 'Initial add: a, c, e'
27 25 $ bzr mv a b
28 26 a => b
29 27 $ bzr mv c d
30 28 c => d
31 29 $ bzr mv e f
32 30 e => f
33 31 $ echo a2 >> a
34 32 $ mkdir e
35 33 $ bzr add -q a e
36 34 $ bzr commit -q -m 'rename a into b, create a, rename c into d'
37 35 $ cd ..
38 36 $ hg convert source source-hg
39 37 scanning source...
40 38 sorting...
41 39 converting...
42 40 1 Initial add: a, c, e
43 41 0 rename a into b, create a, rename c into d
44 42 $ glog -R source-hg
45 43 o 1@source "rename a into b, create a, rename c into d" files: a b c d e f
46 44 |
47 45 o 0@source "Initial add: a, c, e" files: a c e
48 46
49 47
50 48 manifest
51 49
52 50 $ hg manifest -R source-hg -r tip
53 51 a
54 52 b
55 53 d
56 54 f
57 55
58 56 test --rev option
59 57
60 58 $ hg convert -r 1 source source-1-hg
61 59 initializing destination source-1-hg repository
62 60 scanning source...
63 61 sorting...
64 62 converting...
65 63 0 Initial add: a, c, e
66 64 $ glog -R source-1-hg
67 65 o 0@source "Initial add: a, c, e" files: a c e
68 66
69 67
70 68 test with filemap
71 69
72 70 $ cat > filemap <<EOF
73 71 > exclude a
74 72 > EOF
75 73 $ hg convert --filemap filemap source source-filemap-hg
76 74 initializing destination source-filemap-hg repository
77 75 scanning source...
78 76 sorting...
79 77 converting...
80 78 1 Initial add: a, c, e
81 79 0 rename a into b, create a, rename c into d
82 80 $ hg -R source-filemap-hg manifest -r tip
83 81 b
84 82 d
85 83 f
86 84
87 85 convert from lightweight checkout
88 86
89 87 $ bzr checkout --lightweight source source-light
90 88 $ hg convert -s bzr source-light source-light-hg
91 89 initializing destination source-light-hg repository
92 90 warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
93 91 $TESTTMP/test-createandrename/source-light does not look like a Bazaar repository
94 92 abort: source-light: missing or unsupported repository
95 93 [255]
96 94
97 95 extract timestamps that look just like hg's {date|isodate}:
98 96 yyyy-mm-dd HH:MM zzzz (no seconds!)
99 97 compare timestamps
100 98
101 99 $ cd source
102 100 $ bzr log | \
103 101 > sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
104 102 > > ../bzr-timestamps
105 103 $ cd ..
106 104 $ hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
107 105 $ diff -u bzr-timestamps hg-timestamps
108 106 $ cd ..
109 107
110 108 merge
111 109
112 110 $ mkdir test-merge
113 111 $ cd test-merge
114 112 $ cat > helper.py <<EOF
115 113 > import sys
116 114 > from bzrlib import workingtree
117 115 > wt = workingtree.WorkingTree.open('.')
118 116 >
119 117 > message, stamp = sys.argv[1:]
120 118 > wt.commit(message, timestamp=int(stamp))
121 119 > EOF
122 120 $ bzr init -q source
123 121 $ cd source
124 122 $ echo content > a
125 123 $ echo content2 > b
126 124 $ bzr add -q a b
127 125 $ bzr commit -q -m 'Initial add'
128 126 $ cd ..
129 127 $ bzr branch -q source source-improve
130 128 $ cd source
131 129 $ echo more >> a
132 130 $ python ../helper.py 'Editing a' 100
133 131 $ cd ../source-improve
134 132 $ echo content3 >> b
135 133 $ python ../helper.py 'Editing b' 200
136 134 $ cd ../source
137 135 $ bzr merge -q ../source-improve
138 136 $ bzr commit -q -m 'Merged improve branch'
139 137 $ cd ..
140 138 $ hg convert --datesort source source-hg
141 139 initializing destination source-hg repository
142 140 scanning source...
143 141 sorting...
144 142 converting...
145 143 3 Initial add
146 144 2 Editing a
147 145 1 Editing b
148 146 0 Merged improve branch
149 147 $ glog -R source-hg
150 148 o 3@source "Merged improve branch" files:
151 149 |\
152 150 | o 2@source-improve "Editing b" files: b
153 151 | |
154 152 o | 1@source "Editing a" files: a
155 153 |/
156 154 o 0@source "Initial add" files: a b
157 155
158 156 $ cd ..
159 157
158 #if symlink execbit
159
160 160 symlinks and executable files
161 161
162 162 $ mkdir test-symlinks
163 163 $ cd test-symlinks
164 164 $ bzr init -q source
165 165 $ cd source
166 166 $ touch program
167 167 $ chmod +x program
168 168 $ ln -s program altname
169 169 $ mkdir d
170 170 $ echo a > d/a
171 171 $ ln -s a syma
172 172 $ bzr add -q altname program syma d/a
173 173 $ bzr commit -q -m 'Initial setup'
174 174 $ touch newprog
175 175 $ chmod +x newprog
176 176 $ rm altname
177 177 $ ln -s newprog altname
178 178 $ chmod -x program
179 179 $ bzr add -q newprog
180 180 $ bzr commit -q -m 'Symlink changed, x bits changed'
181 181 $ cd ..
182 182 $ hg convert source source-hg
183 183 initializing destination source-hg repository
184 184 scanning source...
185 185 sorting...
186 186 converting...
187 187 1 Initial setup
188 188 0 Symlink changed, x bits changed
189 189 $ manifest source-hg 0
190 190 % manifest of 0
191 191 644 @ altname
192 192 644 d/a
193 193 755 * program
194 194 644 @ syma
195 195 $ manifest source-hg tip
196 196 % manifest of tip
197 197 644 @ altname
198 198 644 d/a
199 199 755 * newprog
200 200 644 program
201 201 644 @ syma
202 $ cd source-hg
203 202
204 203 test the symlinks can be recreated
205 204
205 $ cd source-hg
206 206 $ hg up
207 207 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 208 $ hg cat syma; echo
209 209 a
210 $ cd ../..
211
212 #endif
210 213
211 214 Multiple branches
212 215
213 216 $ bzr init-repo -q --no-trees repo
214 217 $ bzr init -q repo/trunk
215 218 $ bzr co repo/trunk repo-trunk
216 219 $ cd repo-trunk
217 220 $ echo a > a
218 221 $ bzr add a
219 222 adding a
220 223 $ bzr ci -qm adda --commit-time '2012-01-01 00:00:01 +0000'
221 224 $ bzr tag trunk-tag
222 225 Created tag trunk-tag.
223 226 $ bzr switch -b branch
224 227 Tree is up to date at revision 1.
225 228 Switched to branch: *repo/branch/ (glob)
226 229 $ echo b > b
227 230 $ bzr add b
228 231 adding b
229 232 $ bzr ci -qm addb --commit-time '2012-01-01 00:00:02 +0000'
230 233 $ bzr tag branch-tag
231 234 Created tag branch-tag.
232 235 $ bzr switch --force ../repo/trunk
233 236 Updated to revision 1.
234 237 Switched to branch: */repo/trunk/ (glob)
235 238 $ echo a >> a
236 239 $ bzr ci -qm changea --commit-time '2012-01-01 00:00:03 +0000'
237 240 $ cd ..
238 241 $ hg convert --datesort repo repo-bzr
239 242 initializing destination repo-bzr repository
240 243 scanning source...
241 244 sorting...
242 245 converting...
243 246 2 adda
244 247 1 addb
245 248 0 changea
246 249 updating tags
247 250 $ (cd repo-bzr; glog)
248 251 o 3@default "update tags" files: .hgtags
249 252 |
250 253 o 2@default "changea" files: a
251 254 |
252 255 | o 1@branch "addb" files: b
253 256 |/
254 257 o 0@default "adda" files: a
255 258
256 259
257 260 Test tags (converted identifiers are not stable because bzr ones are
258 261 not and get incorporated in extra fields).
259 262
260 263 $ hg -R repo-bzr tags
261 264 tip 3:* (glob)
262 265 branch-tag 1:* (glob)
263 266 trunk-tag 0:* (glob)
264 267
265 268 Nested repositories (issue3254)
266 269
267 270 $ bzr init-repo -q --no-trees repo/inner
268 271 $ bzr init -q repo/inner/trunk
269 272 $ bzr co repo/inner/trunk inner-trunk
270 273 $ cd inner-trunk
271 274 $ echo b > b
272 275 $ bzr add b
273 276 adding b
274 277 $ bzr ci -qm addb
275 278 $ cd ..
276 279 $ hg convert --datesort repo noinner-bzr
277 280 initializing destination noinner-bzr repository
278 281 scanning source...
279 282 sorting...
280 283 converting...
281 284 2 adda
282 285 1 addb
283 286 0 changea
284 287 updating tags
@@ -1,140 +1,149 b''
1 $ "$TESTDIR/hghave" execbit || exit 80
2
3 1 $ cat >> $HGRCPATH <<EOF
4 2 > [extensions]
5 3 > convert=
6 4 > [convert]
7 5 > hg.saverev=False
8 6 > EOF
9 7 $ hg init orig
10 8 $ cd orig
11 9 $ echo foo > foo
12 10 $ echo bar > bar
13 11 $ hg ci -qAm 'add foo bar' -d '0 0'
14 12 $ echo >> foo
15 13 $ hg ci -m 'change foo' -d '1 0'
16 14 $ hg up -qC 0
17 15 $ hg copy --after --force foo bar
18 16 $ hg copy foo baz
19 17 $ hg ci -m 'make bar and baz copies of foo' -d '2 0'
20 18 created new head
21 19 $ hg bookmark premerge1
22 20 $ hg merge -r 1
23 21 merging baz and foo to baz
24 22 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
25 23 (branch merge, don't forget to commit)
26 24 $ hg ci -m 'merge local copy' -d '3 0'
27 25 $ hg up -C 1
28 26 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
29 27 $ hg bookmark premerge2
30 28 $ hg merge 2
31 29 merging foo and baz to baz
32 30 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
33 31 (branch merge, don't forget to commit)
34 32 $ hg ci -m 'merge remote copy' -d '4 0'
35 33 created new head
34 #if execbit
36 35 $ chmod +x baz
36 #else
37 $ echo some other change to make sure we get a rev 5 > baz
38 #endif
37 39 $ hg ci -m 'mark baz executable' -d '5 0'
38 40 $ cd ..
39 41 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
40 42 initializing destination new repository
41 43 scanning source...
42 44 sorting...
43 45 converting...
44 46 5 add foo bar
45 47 4 change foo
46 48 3 make bar and baz copies of foo
47 49 2 merge local copy
48 50 1 merge remote copy
49 51 0 mark baz executable
50 52 updating bookmarks
51 53 $ cd new
52 54 $ hg out ../orig
53 55 comparing with ../orig
54 56 searching for changes
55 57 no changes found
56 58 [1]
59 #if execbit
57 60 $ hg bookmarks
58 61 premerge1 3:973ef48a98a4
59 62 premerge2 5:13d9b87cf8f8
63 #else
64 Different hash because no x bit
65 $ hg bookmarks
66 premerge1 3:973ef48a98a4
67 premerge2 5:df0779bcf33c
68 #endif
60 69 $ cd ..
61 70
62 71 check shamap LF and CRLF handling
63 72
64 73 $ cat > rewrite.py <<EOF
65 74 > import sys
66 75 > # Interlace LF and CRLF
67 76 > lines = [(l.rstrip() + ((i % 2) and '\n' or '\r\n'))
68 77 > for i, l in enumerate(file(sys.argv[1]))]
69 78 > file(sys.argv[1], 'wb').write(''.join(lines))
70 79 > EOF
71 80 $ python rewrite.py new/.hg/shamap
72 81 $ cd orig
73 82 $ hg up -qC 1
74 83 $ echo foo >> foo
75 84 $ hg ci -qm 'change foo again'
76 85 $ hg up -qC 2
77 86 $ echo foo >> foo
78 87 $ hg ci -qm 'change foo again again'
79 88 $ cd ..
80 89 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
81 90 scanning source...
82 91 sorting...
83 92 converting...
84 93 1 change foo again again
85 94 0 change foo again
86 95 updating bookmarks
87 96
88 97 init broken repository
89 98
90 99 $ hg init broken
91 100 $ cd broken
92 101 $ echo a >> a
93 102 $ echo b >> b
94 103 $ hg ci -qAm init
95 104 $ echo a >> a
96 105 $ echo b >> b
97 106 $ hg copy b c
98 107 $ hg ci -qAm changeall
99 108 $ hg up -qC 0
100 109 $ echo bc >> b
101 110 $ hg ci -m changebagain
102 111 created new head
103 112 $ HGMERGE=internal:local hg -q merge
104 113 $ hg ci -m merge
105 114 $ hg mv b d
106 115 $ hg ci -m moveb
107 116
108 117 break it
109 118
110 119 $ rm .hg/store/data/b.*
111 120 $ cd ..
112 121 $ hg --config convert.hg.ignoreerrors=True convert broken fixed
113 122 initializing destination fixed repository
114 123 scanning source...
115 124 sorting...
116 125 converting...
117 126 4 init
118 127 ignoring: data/b.i@1e88685f5dde: no match found
119 128 3 changeall
120 129 2 changebagain
121 130 1 merge
122 131 0 moveb
123 132 $ hg -R fixed verify
124 133 checking changesets
125 134 checking manifests
126 135 crosschecking files in changesets and manifests
127 136 checking files
128 137 3 files, 5 changesets, 5 total revisions
129 138
130 139 manifest -r 0
131 140
132 141 $ hg -R fixed manifest -r 0
133 142 a
134 143
135 144 manifest -r tip
136 145
137 146 $ hg -R fixed manifest -r tip
138 147 a
139 148 c
140 149 d
@@ -1,405 +1,422 b''
1 $ "$TESTDIR/hghave" svn13 no-outer-repo symlink execbit || exit 80
1 $ "$TESTDIR/hghave" svn13 no-outer-repo symlink || exit 80
2 2
3 3 $ fixpath()
4 4 > {
5 5 > tr '\\' /
6 6 > }
7 7 $ svnupanddisplay()
8 8 > {
9 9 > (
10 10 > cd $1;
11 11 > svn up -q;
12 12 > svn st -v | fixpath | sed 's/ */ /g' | sort
13 13 > limit=''
14 14 > if [ $2 -gt 0 ]; then
15 15 > limit="--limit=$2"
16 16 > fi
17 17 > svn log --xml -v $limit | python "$TESTDIR/svnxml.py"
18 18 > )
19 19 > }
20 20
21 21 $ cat >> $HGRCPATH <<EOF
22 22 > [extensions]
23 23 > convert =
24 24 > graphlog =
25 25 > EOF
26 26
27 27 $ hg init a
28 28
29 29 Add
30 30
31 31 $ echo a > a/a
32 32 $ mkdir -p a/d1/d2
33 33 $ echo b > a/d1/d2/b
34 34 $ ln -s a/missing a/link
35 35 $ hg --cwd a ci -d '0 0' -A -m 'add a file'
36 36 adding a
37 37 adding d1/d2/b
38 38 adding link
39 39
40 40 Modify
41 41
42 42 $ "$TESTDIR/svn-safe-append.py" a a/a
43 43 $ hg --cwd a ci -d '1 0' -m 'modify a file'
44 44 $ hg --cwd a tip -q
45 45 1:8231f652da37
46 46
47 47 $ hg convert -d svn a
48 48 assuming destination a-hg
49 49 initializing svn repository 'a-hg'
50 50 initializing svn working copy 'a-hg-wc'
51 51 scanning source...
52 52 sorting...
53 53 converting...
54 54 1 add a file
55 55 0 modify a file
56 56 $ svnupanddisplay a-hg-wc 2
57 57 2 1 test d1
58 58 2 1 test d1/d2
59 59 2 1 test d1/d2/b
60 60 2 1 test link
61 61 2 2 test .
62 62 2 2 test a
63 63 revision: 2
64 64 author: test
65 65 msg: modify a file
66 66 M /a
67 67 revision: 1
68 68 author: test
69 69 msg: add a file
70 70 A /a
71 71 A /d1
72 72 A /d1/d2
73 73 A /d1/d2/b
74 74 A /link
75 75 $ ls a a-hg-wc
76 76 a:
77 77 a
78 78 d1
79 79 link
80 80
81 81 a-hg-wc:
82 82 a
83 83 d1
84 84 link
85 85 $ cmp a/a a-hg-wc/a
86 86
87 87 Rename
88 88
89 89 $ hg --cwd a mv a b
90 90 $ hg --cwd a mv link newlink
91 91
92 92 $ hg --cwd a ci -d '2 0' -m 'rename a file'
93 93 $ hg --cwd a tip -q
94 94 2:a67e26ccec09
95 95
96 96 $ hg convert -d svn a
97 97 assuming destination a-hg
98 98 initializing svn working copy 'a-hg-wc'
99 99 scanning source...
100 100 sorting...
101 101 converting...
102 102 0 rename a file
103 103 $ svnupanddisplay a-hg-wc 1
104 104 3 1 test d1
105 105 3 1 test d1/d2
106 106 3 1 test d1/d2/b
107 107 3 3 test .
108 108 3 3 test b
109 109 3 3 test newlink
110 110 revision: 3
111 111 author: test
112 112 msg: rename a file
113 113 D /a
114 114 A /b (from /a@2)
115 115 D /link
116 116 A /newlink (from /link@2)
117 117 $ ls a a-hg-wc
118 118 a:
119 119 b
120 120 d1
121 121 newlink
122 122
123 123 a-hg-wc:
124 124 b
125 125 d1
126 126 newlink
127 127
128 128 Copy
129 129
130 130 $ hg --cwd a cp b c
131 131
132 132 $ hg --cwd a ci -d '3 0' -m 'copy a file'
133 133 $ hg --cwd a tip -q
134 134 3:0cf087b9ab02
135 135
136 136 $ hg convert -d svn a
137 137 assuming destination a-hg
138 138 initializing svn working copy 'a-hg-wc'
139 139 scanning source...
140 140 sorting...
141 141 converting...
142 142 0 copy a file
143 143 $ svnupanddisplay a-hg-wc 1
144 144 4 1 test d1
145 145 4 1 test d1/d2
146 146 4 1 test d1/d2/b
147 147 4 3 test b
148 148 4 3 test newlink
149 149 4 4 test .
150 150 4 4 test c
151 151 revision: 4
152 152 author: test
153 153 msg: copy a file
154 154 A /c (from /b@3)
155 155 $ ls a a-hg-wc
156 156 a:
157 157 b
158 158 c
159 159 d1
160 160 newlink
161 161
162 162 a-hg-wc:
163 163 b
164 164 c
165 165 d1
166 166 newlink
167 167
168 168 $ hg --cwd a rm b
169 169
170 170 Remove
171 171
172 172 $ hg --cwd a ci -d '4 0' -m 'remove a file'
173 173 $ hg --cwd a tip -q
174 174 4:07b2e34a5b17
175 175
176 176 $ hg convert -d svn a
177 177 assuming destination a-hg
178 178 initializing svn working copy 'a-hg-wc'
179 179 scanning source...
180 180 sorting...
181 181 converting...
182 182 0 remove a file
183 183 $ svnupanddisplay a-hg-wc 1
184 184 5 1 test d1
185 185 5 1 test d1/d2
186 186 5 1 test d1/d2/b
187 187 5 3 test newlink
188 188 5 4 test c
189 189 5 5 test .
190 190 revision: 5
191 191 author: test
192 192 msg: remove a file
193 193 D /b
194 194 $ ls a a-hg-wc
195 195 a:
196 196 c
197 197 d1
198 198 newlink
199 199
200 200 a-hg-wc:
201 201 c
202 202 d1
203 203 newlink
204 204
205 Exectutable
205 Executable
206 206
207 #if execbit
207 208 $ chmod +x a/c
209 #else
210 $ echo fake >> a/c
211 #endif
208 212 $ hg --cwd a ci -d '5 0' -m 'make a file executable'
213 #if execbit
209 214 $ hg --cwd a tip -q
210 215 5:31093672760b
216 #else
217 $ hg --cwd a tip -q
218 5:034971d37224
219 #endif
211 220
212 221 $ hg convert -d svn a
213 222 assuming destination a-hg
214 223 initializing svn working copy 'a-hg-wc'
215 224 scanning source...
216 225 sorting...
217 226 converting...
218 227 0 make a file executable
219 228 $ svnupanddisplay a-hg-wc 1
220 229 6 1 test d1
221 230 6 1 test d1/d2
222 231 6 1 test d1/d2/b
223 232 6 3 test newlink
224 233 6 6 test .
225 234 6 6 test c
226 235 revision: 6
227 236 author: test
228 237 msg: make a file executable
229 238 M /c
239 #if execbit
230 240 $ test -x a-hg-wc/c
241 #endif
242 $ rm -rf a a-hg a-hg-wc
231 243
232 244 Executable in new directory
233 245
234 $ rm -rf a a-hg a-hg-wc
235 246 $ hg init a
236 247
237 248 $ mkdir a/d1
238 249 $ echo a > a/d1/a
250 #if execbit
239 251 $ chmod +x a/d1/a
252 #else
253 $ echo fake >> a/d1/a
254 #endif
240 255 $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
241 256 adding d1/a
242 257
243 258 $ hg convert -d svn a
244 259 assuming destination a-hg
245 260 initializing svn repository 'a-hg'
246 261 initializing svn working copy 'a-hg-wc'
247 262 scanning source...
248 263 sorting...
249 264 converting...
250 265 0 add executable file in new directory
251 266 $ svnupanddisplay a-hg-wc 1
252 267 1 1 test .
253 268 1 1 test d1
254 269 1 1 test d1/a
255 270 revision: 1
256 271 author: test
257 272 msg: add executable file in new directory
258 273 A /d1
259 274 A /d1/a
275 #if execbit
260 276 $ test -x a-hg-wc/d1/a
277 #endif
261 278
262 279 Copy to new directory
263 280
264 281 $ mkdir a/d2
265 282 $ hg --cwd a cp d1/a d2/a
266 283 $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
267 284
268 285 $ hg convert -d svn a
269 286 assuming destination a-hg
270 287 initializing svn working copy 'a-hg-wc'
271 288 scanning source...
272 289 sorting...
273 290 converting...
274 291 0 copy file to new directory
275 292 $ svnupanddisplay a-hg-wc 1
276 293 2 1 test d1
277 294 2 1 test d1/a
278 295 2 2 test .
279 296 2 2 test d2
280 297 2 2 test d2/a
281 298 revision: 2
282 299 author: test
283 300 msg: copy file to new directory
284 301 A /d2
285 302 A /d2/a (from /d1/a@1)
286 303
287 304 Branchy history
288 305
289 306 $ hg init b
290 307 $ echo base > b/b
291 308 $ hg --cwd b ci -d '0 0' -Ambase
292 309 adding b
293 310
294 311 $ "$TESTDIR/svn-safe-append.py" left-1 b/b
295 312 $ echo left-1 > b/left-1
296 313 $ hg --cwd b ci -d '1 0' -Amleft-1
297 314 adding left-1
298 315
299 316 $ "$TESTDIR/svn-safe-append.py" left-2 b/b
300 317 $ echo left-2 > b/left-2
301 318 $ hg --cwd b ci -d '2 0' -Amleft-2
302 319 adding left-2
303 320
304 321 $ hg --cwd b up 0
305 322 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
306 323
307 324 $ "$TESTDIR/svn-safe-append.py" right-1 b/b
308 325 $ echo right-1 > b/right-1
309 326 $ hg --cwd b ci -d '3 0' -Amright-1
310 327 adding right-1
311 328 created new head
312 329
313 330 $ "$TESTDIR/svn-safe-append.py" right-2 b/b
314 331 $ echo right-2 > b/right-2
315 332 $ hg --cwd b ci -d '4 0' -Amright-2
316 333 adding right-2
317 334
318 335 $ hg --cwd b up -C 2
319 336 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
320 337 $ hg --cwd b merge
321 338 merging b
322 339 warning: conflicts during merge.
323 340 merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
324 341 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
325 342 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
326 343 [1]
327 344 $ hg --cwd b revert -r 2 b
328 345 $ hg resolve -m b
329 346 $ hg --cwd b ci -d '5 0' -m 'merge'
330 347
331 348 Expect 4 changes
332 349
333 350 $ hg convert -d svn b
334 351 assuming destination b-hg
335 352 initializing svn repository 'b-hg'
336 353 initializing svn working copy 'b-hg-wc'
337 354 scanning source...
338 355 sorting...
339 356 converting...
340 357 5 base
341 358 4 left-1
342 359 3 left-2
343 360 2 right-1
344 361 1 right-2
345 362 0 merge
346 363
347 364 $ svnupanddisplay b-hg-wc 0
348 365 4 2 test left-1
349 366 4 3 test b
350 367 4 3 test left-2
351 368 4 4 test .
352 369 4 4 test right-1
353 370 4 4 test right-2
354 371 revision: 4
355 372 author: test
356 373 msg: merge
357 374 A /right-1
358 375 A /right-2
359 376 revision: 3
360 377 author: test
361 378 msg: left-2
362 379 M /b
363 380 A /left-2
364 381 revision: 2
365 382 author: test
366 383 msg: left-1
367 384 M /b
368 385 A /left-1
369 386 revision: 1
370 387 author: test
371 388 msg: base
372 389 A /b
373 390
374 391 Tags are not supported, but must not break conversion
375 392
376 393 $ rm -rf a a-hg a-hg-wc
377 394 $ hg init a
378 395 $ echo a > a/a
379 396 $ hg --cwd a ci -d '0 0' -A -m 'Add file a'
380 397 adding a
381 398 $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
382 399
383 400 $ hg convert -d svn a
384 401 assuming destination a-hg
385 402 initializing svn repository 'a-hg'
386 403 initializing svn working copy 'a-hg-wc'
387 404 scanning source...
388 405 sorting...
389 406 converting...
390 407 1 Add file a
391 408 0 Tagged as v1.0
392 409 writing Subversion tags is not yet implemented
393 410 $ svnupanddisplay a-hg-wc 2
394 411 2 1 test a
395 412 2 2 test .
396 413 2 2 test .hgtags
397 414 revision: 2
398 415 author: test
399 416 msg: Tagged as v1.0
400 417 A /.hgtags
401 418 revision: 1
402 419 author: test
403 420 msg: Add file a
404 421 A /a
405 422 $ rm -rf a a-hg a-hg-wc
@@ -1,126 +1,128 b''
1 $ "$TESTDIR/hghave" execbit || exit 80
2
3 1 Setup
4 2
5 3 $ echo "[color]" >> $HGRCPATH
6 4 $ echo "mode = ansi" >> $HGRCPATH
7 5 $ echo "[extensions]" >> $HGRCPATH
8 6 $ echo "color=" >> $HGRCPATH
9 7 $ hg init repo
10 8 $ cd repo
11 9 $ cat > a <<EOF
12 10 > c
13 11 > c
14 12 > a
15 13 > a
16 14 > b
17 15 > a
18 16 > a
19 17 > c
20 18 > c
21 19 > EOF
22 20 $ hg ci -Am adda
23 21 adding a
24 22 $ cat > a <<EOF
25 23 > c
26 24 > c
27 25 > a
28 26 > a
29 27 > dd
30 28 > a
31 29 > a
32 30 > c
33 31 > c
34 32 > EOF
35 33
36 34 default context
37 35
38 36 $ hg diff --nodates --color=always
39 37 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
40 38 \x1b[0;31;1m--- a/a\x1b[0m (esc)
41 39 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
42 40 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
43 41 c
44 42 a
45 43 a
46 44 \x1b[0;31m-b\x1b[0m (esc)
47 45 \x1b[0;32m+dd\x1b[0m (esc)
48 46 a
49 47 a
50 48 c
51 49
52 50 --unified=2
53 51
54 52 $ hg diff --nodates -U 2 --color=always
55 53 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
56 54 \x1b[0;31;1m--- a/a\x1b[0m (esc)
57 55 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
58 56 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
59 57 a
60 58 a
61 59 \x1b[0;31m-b\x1b[0m (esc)
62 60 \x1b[0;32m+dd\x1b[0m (esc)
63 61 a
64 62 a
65 63
66 64 diffstat
67 65
68 66 $ hg diff --stat --color=always
69 67 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
70 68 1 files changed, 1 insertions(+), 1 deletions(-)
71 69 $ echo "record=" >> $HGRCPATH
72 70 $ echo "[ui]" >> $HGRCPATH
73 71 $ echo "interactive=true" >> $HGRCPATH
74 72 $ echo "[diff]" >> $HGRCPATH
75 73 $ echo "git=True" >> $HGRCPATH
76 74
75 #if execbit
76
77 77 record
78 78
79 79 $ chmod +x a
80 80 $ hg record --color=always -m moda a <<EOF
81 81 > y
82 82 > y
83 83 > EOF
84 84 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
85 85 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
86 86 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
87 87 1 hunks, 1 lines changed
88 88 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m (esc)
89 89 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
90 90 c
91 91 a
92 92 a
93 93 \x1b[0;31m-b\x1b[0m (esc)
94 94 \x1b[0;32m+dd\x1b[0m (esc)
95 95 a
96 96 a
97 97 c
98 98 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m (esc)
99 99
100 100 $ echo "[extensions]" >> $HGRCPATH
101 101 $ echo "mq=" >> $HGRCPATH
102 102 $ hg rollback
103 103 repository tip rolled back to revision 0 (undo commit)
104 104 working directory now based on revision 0
105 105
106 106 qrecord
107 107
108 108 $ hg qrecord --color=always -m moda patch <<EOF
109 109 > y
110 110 > y
111 111 > EOF
112 112 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
113 113 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
114 114 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
115 115 1 hunks, 1 lines changed
116 116 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m (esc)
117 117 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
118 118 c
119 119 a
120 120 a
121 121 \x1b[0;31m-b\x1b[0m (esc)
122 122 \x1b[0;32m+dd\x1b[0m (esc)
123 123 a
124 124 a
125 125 c
126 126 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m (esc)
127
128 #endif
@@ -1,198 +1,204 b''
1 $ "$TESTDIR/hghave" symlink execbit || exit 80
2
3 1 $ echo "[extensions]" >> $HGRCPATH
4 2 $ echo "extdiff=" >> $HGRCPATH
5 3
6 4 $ hg init a
7 5 $ cd a
8 6 $ echo a > a
9 7 $ echo b > b
10 8 $ hg add
11 9 adding a
12 10 adding b
13 11
14 12 Should diff cloned directories:
15 13
16 14 $ hg extdiff -o -r $opt
17 15 Only in a: a
18 16 Only in a: b
19 17 [1]
20 18
21 19 $ echo "[extdiff]" >> $HGRCPATH
22 20 $ echo "cmd.falabala=echo" >> $HGRCPATH
23 21 $ echo "opts.falabala=diffing" >> $HGRCPATH
24 22
25 23 $ hg falabala
26 24 diffing a.000000000000 a
27 25 [1]
28 26
29 27 $ hg help falabala
30 28 hg falabala [OPTION]... [FILE]...
31 29
32 30 use 'echo' to diff repository (or selected files)
33 31
34 32 Show differences between revisions for the specified files, using the
35 33 'echo' program.
36 34
37 35 When two revision arguments are given, then changes are shown between
38 36 those revisions. If only one revision is specified then that revision is
39 37 compared to the working directory, and, when no revisions are specified,
40 38 the working directory files are compared to its parent.
41 39
42 40 options:
43 41
44 42 -o --option OPT [+] pass option to comparison program
45 43 -r --rev REV [+] revision
46 44 -c --change REV change made by revision
47 45 -I --include PATTERN [+] include names matching the given patterns
48 46 -X --exclude PATTERN [+] exclude names matching the given patterns
49 47
50 48 [+] marked option can be specified multiple times
51 49
52 50 use "hg -v help falabala" to show more info
53 51
54 52 $ hg ci -d '0 0' -mtest1
55 53
56 54 $ echo b >> a
57 55 $ hg ci -d '1 0' -mtest2
58 56
59 57 Should diff cloned files directly:
60 58
61 59 $ hg falabala -r 0:1
62 60 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
63 61 [1]
64 62
65 63 Test diff during merge:
66 64
67 65 $ hg update -C 0
68 66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 67 $ echo c >> c
70 68 $ hg add c
71 69 $ hg ci -m "new branch" -d '1 0'
72 70 created new head
73 71 $ hg merge 1
74 72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 73 (branch merge, don't forget to commit)
76 74
77 75 Should diff cloned file against wc file:
78 76
79 77 $ hg falabala
80 78 diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob)
81 79 [1]
82 80
83 81
84 82 Test --change option:
85 83
86 84 $ hg ci -d '2 0' -mtest3
87 85 $ hg falabala -c 1
88 86 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
89 87 [1]
90 88
91 89 Check diff are made from the first parent:
92 90
93 91 $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
94 92 diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob)
95 93 diff-like tools yield a non-zero exit code
96 94
95 #if execbit
96
97 97 Test extdiff of multiple files in tmp dir:
98 98
99 99 $ hg update -C 0 > /dev/null
100 100 $ echo changed > a
101 101 $ echo changed > b
102 102 $ chmod +x b
103 103
104 104 Diff in working directory, before:
105 105
106 106 $ hg diff --git
107 107 diff --git a/a b/a
108 108 --- a/a
109 109 +++ b/a
110 110 @@ -1,1 +1,1 @@
111 111 -a
112 112 +changed
113 113 diff --git a/b b/b
114 114 old mode 100644
115 115 new mode 100755
116 116 --- a/b
117 117 +++ b/b
118 118 @@ -1,1 +1,1 @@
119 119 -b
120 120 +changed
121 121
122 122
123 123 Edit with extdiff -p:
124 124
125 125 Prepare custom diff/edit tool:
126 126
127 127 $ cat > 'diff tool.py' << EOT
128 128 > #!/usr/bin/env python
129 129 > import time
130 130 > time.sleep(1) # avoid unchanged-timestamp problems
131 131 > file('a/a', 'ab').write('edited\n')
132 132 > file('a/b', 'ab').write('edited\n')
133 133 > EOT
134 134
135 135 $ chmod +x 'diff tool.py'
136 136
137 137 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
138 138 and start tool
139 139
140 140 $ hg extdiff -p "`pwd`/diff tool.py"
141 141 [1]
142 142
143 143 Diff in working directory, after:
144 144
145 145 $ hg diff --git
146 146 diff --git a/a b/a
147 147 --- a/a
148 148 +++ b/a
149 149 @@ -1,1 +1,2 @@
150 150 -a
151 151 +changed
152 152 +edited
153 153 diff --git a/b b/b
154 154 old mode 100644
155 155 new mode 100755
156 156 --- a/b
157 157 +++ b/b
158 158 @@ -1,1 +1,2 @@
159 159 -b
160 160 +changed
161 161 +edited
162 162
163 163 Test extdiff with --option:
164 164
165 165 $ hg extdiff -p echo -o this -c 1
166 166 this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
167 167 [1]
168 168
169 169 $ hg falabala -o this -c 1
170 170 diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
171 171 [1]
172 172
173 173 Test with revsets:
174 174
175 175 $ hg extdif -p echo -c "rev(1)"
176 176 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
177 177 [1]
178 178
179 179 $ hg extdif -p echo -r "0::1"
180 180 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
181 181 [1]
182 182
183 183 $ cd ..
184 184
185 #endif
186
187 #if symlink
188
185 189 Test symlinks handling (issue1909)
186 190
187 191 $ hg init testsymlinks
188 192 $ cd testsymlinks
189 193 $ echo a > a
190 194 $ hg ci -Am adda
191 195 adding a
192 196 $ echo a >> a
193 197 $ ln -s missing linka
194 198 $ hg add linka
195 199 $ hg falabala -r 0 --traceback
196 200 diffing testsymlinks.07f494440405 testsymlinks
197 201 [1]
198 202 $ cd ..
203
204 #endif
@@ -1,351 +1,362 b''
1 $ "$TESTDIR/hghave" execbit || exit 80
2
3 1 $ hg init
4 2 $ echo start > start
5 3 $ hg ci -Amstart
6 4 adding start
7 5
8 6 New file:
9 7
10 8 $ echo new > new
11 9 $ hg ci -Amnew
12 10 adding new
13 11 $ hg diff --git -r 0
14 12 diff --git a/new b/new
15 13 new file mode 100644
16 14 --- /dev/null
17 15 +++ b/new
18 16 @@ -0,0 +1,1 @@
19 17 +new
20 18
21 19 Copy:
22 20
23 21 $ hg cp new copy
24 22 $ hg ci -mcopy
25 23 $ hg diff --git -r 1:tip
26 24 diff --git a/new b/copy
27 25 copy from new
28 26 copy to copy
29 27
30 28 Rename:
31 29
32 30 $ hg mv copy rename
33 31 $ hg ci -mrename
34 32 $ hg diff --git -r 2:tip
35 33 diff --git a/copy b/rename
36 34 rename from copy
37 35 rename to rename
38 36
39 37 Delete:
40 38
41 39 $ hg rm rename
42 40 $ hg ci -mdelete
43 41 $ hg diff --git -r 3:tip
44 42 diff --git a/rename b/rename
45 43 deleted file mode 100644
46 44 --- a/rename
47 45 +++ /dev/null
48 46 @@ -1,1 +0,0 @@
49 47 -new
50 48
51 49 $ cat > src <<EOF
52 50 > 1
53 51 > 2
54 52 > 3
55 53 > 4
56 54 > 5
57 55 > EOF
58 56 $ hg ci -Amsrc
59 57 adding src
60 58
59 #if execbit
60
61 61 chmod 644:
62 62
63 63 $ chmod +x src
64 64 $ hg ci -munexec
65 65 $ hg diff --git -r 5:tip
66 66 diff --git a/src b/src
67 67 old mode 100644
68 68 new mode 100755
69 69
70 70 Rename+mod+chmod:
71 71
72 72 $ hg mv src dst
73 73 $ chmod -x dst
74 74 $ echo a >> dst
75 75 $ hg ci -mrenamemod
76 76 $ hg diff --git -r 6:tip
77 77 diff --git a/src b/dst
78 78 old mode 100755
79 79 new mode 100644
80 80 rename from src
81 81 rename to dst
82 82 --- a/src
83 83 +++ b/dst
84 84 @@ -3,3 +3,4 @@
85 85 3
86 86 4
87 87 5
88 88 +a
89 89
90 90 Nonexistent in tip+chmod:
91 91
92 92 $ hg diff --git -r 5:6
93 93 diff --git a/src b/src
94 94 old mode 100644
95 95 new mode 100755
96 96
97 #else
98
99 Dummy changes when no exec bit, mocking the execbit commit structure
100
101 $ echo change >> src
102 $ hg ci -munexec
103 $ hg mv src dst
104 $ hg ci -mrenamemod
105
106 #endif
107
97 108 Binary diff:
98 109
99 110 $ cp "$TESTDIR/binfile.bin" .
100 111 $ hg add binfile.bin
101 112 $ hg diff --git > b.diff
102 113 $ cat b.diff
103 114 diff --git a/binfile.bin b/binfile.bin
104 115 new file mode 100644
105 116 index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
106 117 GIT binary patch
107 118 literal 593
108 119 zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU
109 120 z000XU0RWnu7ytkO2XskIMF-Uh9TW;VpMjwv0005-Nkl<ZD9@FWPs=e;7{<>W$NUkd
110 121 zX$nnYLt$-$V!?uy+1V%`z&Eh=ah|duER<4|QWhju3gb^nF*8iYobxWG-qqXl=2~5M
111 122 z*IoDB)sG^CfNuoBmqLTVU^<;@nwHP!1wrWd`{(mHo6VNXWtyh{alzqmsH*yYzpvLT
112 123 zLdY<T=ks|woh-`&01!ej#(xbV1f|pI*=%;d-%F*E*X#ZH`4I%6SS+$EJDE&ct=8po
113 124 ziN#{?_j|kD%Cd|oiqds`xm@;oJ-^?NG3Gdqrs?5u*zI;{nogxsx~^|Fn^Y?Gdc6<;
114 125 zfMJ+iF1J`LMx&A2?dEwNW8ClebzPTbIh{@$hS6*`kH@1d%Lo7fA#}N1)oN7`gm$~V
115 126 z+wDx#)OFqMcE{s!JN0-xhG8ItAjVkJwEcb`3WWlJfU2r?;Pd%dmR+q@mSri5q9_W-
116 127 zaR2~ECX?B2w+zELozC0s*6Z~|QG^f{3I#<`?)Q7U-JZ|q5W;9Q8i_=pBuSzunx=U;
117 128 z9C)5jBoYw9^?EHyQl(M}1OlQcCX>lXB*ODN003Z&P17_@)3Pi=i0wb04<W?v-u}7K
118 129 zXmmQA+wDgE!qR9o8jr`%=ab_&uh(l?R=r;Tjiqon91I2-hIu?57~@*4h7h9uORK#=
119 130 fQItJW-{SoTm)8|5##k|m00000NkvXXu0mjf{mKw4
120 131
121 132
122 133 Import binary diff:
123 134
124 135 $ hg revert binfile.bin
125 136 $ rm binfile.bin
126 137 $ hg import -mfoo b.diff
127 138 applying b.diff
128 139 $ cmp binfile.bin "$TESTDIR/binfile.bin"
129 140
130 141 Rename binary file:
131 142
132 143 $ hg mv binfile.bin renamed.bin
133 144 $ hg diff --git
134 145 diff --git a/binfile.bin b/renamed.bin
135 146 rename from binfile.bin
136 147 rename to renamed.bin
137 148
138 149 Diff across many revisions:
139 150
140 151 $ hg mv dst dst2
141 152 $ hg ci -m 'mv dst dst2'
142 153
143 154 $ echo >> start
144 155 $ hg ci -m 'change start'
145 156
146 157 $ hg revert -r -2 start
147 158 $ hg mv dst2 dst3
148 159 $ hg ci -m 'mv dst2 dst3; revert start'
149 160
150 161 $ hg diff --git -r 9:11
151 162 diff --git a/dst2 b/dst3
152 163 rename from dst2
153 164 rename to dst3
154 165
155 166 Reversed:
156 167
157 168 $ hg diff --git -r 11:9
158 169 diff --git a/dst3 b/dst2
159 170 rename from dst3
160 171 rename to dst2
161 172
162 173
163 174 $ echo a >> foo
164 175 $ hg add foo
165 176 $ hg ci -m 'add foo'
166 177 $ echo b >> foo
167 178 $ hg ci -m 'change foo'
168 179 $ hg mv foo bar
169 180 $ hg ci -m 'mv foo bar'
170 181 $ echo c >> bar
171 182 $ hg ci -m 'change bar'
172 183
173 184 File created before r1 and renamed before r2:
174 185
175 186 $ hg diff --git -r -3:-1
176 187 diff --git a/foo b/bar
177 188 rename from foo
178 189 rename to bar
179 190 --- a/foo
180 191 +++ b/bar
181 192 @@ -1,2 +1,3 @@
182 193 a
183 194 b
184 195 +c
185 196
186 197 Reversed:
187 198
188 199 $ hg diff --git -r -1:-3
189 200 diff --git a/bar b/foo
190 201 rename from bar
191 202 rename to foo
192 203 --- a/bar
193 204 +++ b/foo
194 205 @@ -1,3 +1,2 @@
195 206 a
196 207 b
197 208 -c
198 209
199 210 File created in r1 and renamed before r2:
200 211
201 212 $ hg diff --git -r -4:-1
202 213 diff --git a/foo b/bar
203 214 rename from foo
204 215 rename to bar
205 216 --- a/foo
206 217 +++ b/bar
207 218 @@ -1,1 +1,3 @@
208 219 a
209 220 +b
210 221 +c
211 222
212 223 Reversed:
213 224
214 225 $ hg diff --git -r -1:-4
215 226 diff --git a/bar b/foo
216 227 rename from bar
217 228 rename to foo
218 229 --- a/bar
219 230 +++ b/foo
220 231 @@ -1,3 +1,1 @@
221 232 a
222 233 -b
223 234 -c
224 235
225 236 File created after r1 and renamed before r2:
226 237
227 238 $ hg diff --git -r -5:-1
228 239 diff --git a/bar b/bar
229 240 new file mode 100644
230 241 --- /dev/null
231 242 +++ b/bar
232 243 @@ -0,0 +1,3 @@
233 244 +a
234 245 +b
235 246 +c
236 247
237 248 Reversed:
238 249
239 250 $ hg diff --git -r -1:-5
240 251 diff --git a/bar b/bar
241 252 deleted file mode 100644
242 253 --- a/bar
243 254 +++ /dev/null
244 255 @@ -1,3 +0,0 @@
245 256 -a
246 257 -b
247 258 -c
248 259
249 260
250 261 Comparing with the working dir:
251 262
252 263 $ echo >> start
253 264 $ hg ci -m 'change start again'
254 265
255 266 $ echo > created
256 267 $ hg add created
257 268 $ hg ci -m 'add created'
258 269
259 270 $ hg mv created created2
260 271 $ hg ci -m 'mv created created2'
261 272
262 273 $ hg mv created2 created3
263 274
264 275 There's a copy in the working dir:
265 276
266 277 $ hg diff --git
267 278 diff --git a/created2 b/created3
268 279 rename from created2
269 280 rename to created3
270 281
271 282 There's another copy between the original rev and the wd:
272 283
273 284 $ hg diff --git -r -2
274 285 diff --git a/created b/created3
275 286 rename from created
276 287 rename to created3
277 288
278 289 The source of the copy was created after the original rev:
279 290
280 291 $ hg diff --git -r -3
281 292 diff --git a/created3 b/created3
282 293 new file mode 100644
283 294 --- /dev/null
284 295 +++ b/created3
285 296 @@ -0,0 +1,1 @@
286 297 +
287 298 $ hg ci -m 'mv created2 created3'
288 299
289 300
290 301 $ echo > brand-new
291 302 $ hg add brand-new
292 303 $ hg ci -m 'add brand-new'
293 304 $ hg mv brand-new brand-new2
294 305
295 306 Created in parent of wd; renamed in the wd:
296 307
297 308 $ hg diff --git
298 309 diff --git a/brand-new b/brand-new2
299 310 rename from brand-new
300 311 rename to brand-new2
301 312
302 313 Created between r1 and parent of wd; renamed in the wd:
303 314
304 315 $ hg diff --git -r -2
305 316 diff --git a/brand-new2 b/brand-new2
306 317 new file mode 100644
307 318 --- /dev/null
308 319 +++ b/brand-new2
309 320 @@ -0,0 +1,1 @@
310 321 +
311 322 $ hg ci -m 'mv brand-new brand-new2'
312 323
313 324 One file is copied to many destinations and removed:
314 325
315 326 $ hg cp brand-new2 brand-new3
316 327 $ hg mv brand-new2 brand-new3-2
317 328 $ hg ci -m 'multiple renames/copies'
318 329 $ hg diff --git -r -2 -r -1
319 330 diff --git a/brand-new2 b/brand-new3
320 331 rename from brand-new2
321 332 rename to brand-new3
322 333 diff --git a/brand-new2 b/brand-new3-2
323 334 copy from brand-new2
324 335 copy to brand-new3-2
325 336
326 337 Reversed:
327 338
328 339 $ hg diff --git -r -1 -r -2
329 340 diff --git a/brand-new3 b/brand-new2
330 341 rename from brand-new3
331 342 rename to brand-new2
332 343 diff --git a/brand-new3-2 b/brand-new3-2
333 344 deleted file mode 100644
334 345 --- a/brand-new3-2
335 346 +++ /dev/null
336 347 @@ -1,1 +0,0 @@
337 348 -
338 349
339 350 There should be a trailing TAB if there are spaces in the file name:
340 351
341 352 $ echo foo > 'with spaces'
342 353 $ hg add 'with spaces'
343 354 $ hg diff --git
344 355 diff --git a/with spaces b/with spaces
345 356 new file mode 100644
346 357 --- /dev/null
347 358 +++ b/with spaces
348 359 @@ -0,0 +1,1 @@
349 360 +foo
350 361 $ hg ci -m 'add filename with spaces'
351 362
@@ -1,267 +1,268 b''
1 $ "$TESTDIR/hghave" symlink execbit || exit 80
2
3 1 $ echo "[extensions]" >> $HGRCPATH
4 2 $ echo "purge=" >> $HGRCPATH
5 3 $ echo "graphlog=" >> $HGRCPATH
6 4
7 5 $ shortlog() {
8 6 > hg glog --template '{rev}:{node|short} {author} {date|hgdate} - {branch} - {desc|firstline}\n'
9 7 > }
10 8
11 9 Test --bypass with other options
12 10
13 11 $ hg init repo-options
14 12 $ cd repo-options
15 13 $ echo a > a
16 14 $ hg ci -Am adda
17 15 adding a
18 16 $ echo a >> a
19 17 $ hg branch foo
20 18 marked working directory as branch foo
21 19 (branches are permanent and global, did you want a bookmark?)
22 20 $ hg ci -Am changea
23 21 $ hg export . > ../test.diff
24 22 $ hg up null
25 23 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26 24
27 25 Test importing an existing revision
28 26
29 27 $ hg import --bypass --exact ../test.diff
30 28 applying ../test.diff
31 29 $ shortlog
32 30 o 1:4e322f7ce8e3 test 0 0 - foo - changea
33 31 |
34 32 o 0:07f494440405 test 0 0 - default - adda
35 33
36 34
37 35 Test failure without --exact
38 36
39 37 $ hg import --bypass ../test.diff
40 38 applying ../test.diff
41 39 unable to find 'a' for patching
42 40 abort: patch failed to apply
43 41 [255]
44 42 $ hg st
45 43 $ shortlog
46 44 o 1:4e322f7ce8e3 test 0 0 - foo - changea
47 45 |
48 46 o 0:07f494440405 test 0 0 - default - adda
49 47
50 48
51 49 Test --user, --date and --message
52 50
53 51 $ hg up 0
54 52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 53 $ hg import --bypass --u test2 -d '1 0' -m patch2 ../test.diff
56 54 applying ../test.diff
57 55 $ cat .hg/last-message.txt
58 56 patch2 (no-eol)
59 57 $ shortlog
60 58 o 2:2e127d1da504 test2 1 0 - default - patch2
61 59 |
62 60 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
63 61 |/
64 62 @ 0:07f494440405 test 0 0 - default - adda
65 63
66 64 $ hg rollback
67 65 repository tip rolled back to revision 1 (undo import)
68 66
69 67 Test --import-branch
70 68
71 69 $ hg import --bypass --import-branch ../test.diff
72 70 applying ../test.diff
73 71 $ shortlog
74 72 o 1:4e322f7ce8e3 test 0 0 - foo - changea
75 73 |
76 74 @ 0:07f494440405 test 0 0 - default - adda
77 75
78 76 $ hg rollback
79 77 repository tip rolled back to revision 1 (undo import)
80 78
81 79 Test --strip
82 80
83 81 $ hg import --bypass --strip 0 - <<EOF
84 82 > # HG changeset patch
85 83 > # User test
86 84 > # Date 0 0
87 85 > # Branch foo
88 86 > # Node ID 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c
89 87 > # Parent 07f4944404050f47db2e5c5071e0e84e7a27bba9
90 88 > changea
91 89 >
92 90 > diff -r 07f494440405 -r 4e322f7ce8e3 a
93 91 > --- a Thu Jan 01 00:00:00 1970 +0000
94 92 > +++ a Thu Jan 01 00:00:00 1970 +0000
95 93 > @@ -1,1 +1,2 @@
96 94 > a
97 95 > +a
98 96 > EOF
99 97 applying patch from stdin
100 98 $ hg rollback
101 99 repository tip rolled back to revision 1 (undo import)
102 100
103 101 Test unsupported combinations
104 102
105 103 $ hg import --bypass --no-commit ../test.diff
106 104 abort: cannot use --no-commit with --bypass
107 105 [255]
108 106 $ hg import --bypass --similarity 50 ../test.diff
109 107 abort: cannot use --similarity with --bypass
110 108 [255]
111 109
112 110 Test commit editor
113 111
114 112 $ cat > ../test.diff <<EOF
115 113 > diff -r 07f494440405 -r 4e322f7ce8e3 a
116 114 > --- a/a Thu Jan 01 00:00:00 1970 +0000
117 115 > +++ b/a Thu Jan 01 00:00:00 1970 +0000
118 116 > @@ -1,1 +1,2 @@
119 117 > -a
120 118 > +b
121 119 > +c
122 120 > EOF
123 121 $ HGEDITOR=cat hg import --bypass ../test.diff
124 122 applying ../test.diff
125 123
126 124
127 125 HG: Enter commit message. Lines beginning with 'HG:' are removed.
128 126 HG: Leave message empty to abort commit.
129 127 HG: --
130 128 HG: user: test
131 129 HG: branch 'default'
132 130 HG: changed a
133 131 abort: empty commit message
134 132 [255]
135 133
136 134 Test patch.eol is handled
137 135
138 136 $ python -c 'file("a", "wb").write("a\r\n")'
139 137 $ hg ci -m makeacrlf
140 138 $ hg import -m 'should fail because of eol' --bypass ../test.diff
141 139 applying ../test.diff
142 140 patching file a
143 141 Hunk #1 FAILED at 0
144 142 abort: patch failed to apply
145 143 [255]
146 144 $ hg --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff
147 145 applying ../test.diff
148 146 $ shortlog
149 147 o 3:c606edafba99 test 0 0 - default - test patch.eol
150 148 |
151 149 @ 2:872023de769d test 0 0 - default - makeacrlf
152 150 |
153 151 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
154 152 |/
155 153 o 0:07f494440405 test 0 0 - default - adda
156 154
157 155
158 156 Test applying multiple patches
159 157
160 158 $ hg up -qC 0
161 159 $ echo e > e
162 160 $ hg ci -Am adde
163 161 adding e
164 162 created new head
165 163 $ hg export . > ../patch1.diff
166 164 $ hg up -qC 1
167 165 $ echo f > f
168 166 $ hg ci -Am addf
169 167 adding f
170 168 $ hg export . > ../patch2.diff
171 169 $ cd ..
172 170 $ hg clone -r1 repo-options repo-multi1
173 171 adding changesets
174 172 adding manifests
175 173 adding file changes
176 174 added 2 changesets with 2 changes to 1 files
177 175 updating to branch foo
178 176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
179 177 $ cd repo-multi1
180 178 $ hg up 0
181 179 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 180 $ hg import --bypass ../patch1.diff ../patch2.diff
183 181 applying ../patch1.diff
184 182 applying ../patch2.diff
185 183 $ shortlog
186 184 o 3:bc8ca3f8a7c4 test 0 0 - default - addf
187 185 |
188 186 o 2:16581080145e test 0 0 - default - adde
189 187 |
190 188 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
191 189 |/
192 190 @ 0:07f494440405 test 0 0 - default - adda
193 191
194 192
195 193 Test applying multiple patches with --exact
196 194
197 195 $ cd ..
198 196 $ hg clone -r1 repo-options repo-multi2
199 197 adding changesets
200 198 adding manifests
201 199 adding file changes
202 200 added 2 changesets with 2 changes to 1 files
203 201 updating to branch foo
204 202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 203 $ cd repo-multi2
206 204 $ hg import --bypass --exact ../patch1.diff ../patch2.diff
207 205 applying ../patch1.diff
208 206 applying ../patch2.diff
209 207 $ shortlog
210 208 o 3:d60cb8989666 test 0 0 - foo - addf
211 209 |
212 210 | o 2:16581080145e test 0 0 - default - adde
213 211 | |
214 212 @ | 1:4e322f7ce8e3 test 0 0 - foo - changea
215 213 |/
216 214 o 0:07f494440405 test 0 0 - default - adda
217 215
218 216
219 217 $ cd ..
220 218
219 #if symlink execbit
220
221 221 Test complicated patch with --exact
222 222
223 223 $ hg init repo-exact
224 224 $ cd repo-exact
225 225 $ echo a > a
226 226 $ echo c > c
227 227 $ echo d > d
228 228 $ echo e > e
229 229 $ echo f > f
230 230 $ chmod +x f
231 231 $ ln -s c linkc
232 232 $ hg ci -Am t
233 233 adding a
234 234 adding c
235 235 adding d
236 236 adding e
237 237 adding f
238 238 adding linkc
239 239 $ hg cp a aa1
240 240 $ echo b >> a
241 241 $ echo b > b
242 242 $ hg add b
243 243 $ hg cp a aa2
244 244 $ echo aa >> aa2
245 245 $ chmod +x e
246 246 $ chmod -x f
247 247 $ ln -s a linka
248 248 $ hg rm d
249 249 $ hg rm linkc
250 250 $ hg mv c cc
251 251 $ hg ci -m patch
252 252 $ hg export --git . > ../test.diff
253 253 $ hg up -C null
254 254 0 files updated, 0 files merged, 7 files removed, 0 files unresolved
255 255 $ hg purge
256 256 $ hg st
257 257 $ hg import --bypass --exact ../test.diff
258 258 applying ../test.diff
259 259
260 260 The patch should have matched the exported revision and generated no additional
261 261 data. If not, diff both heads to debug it.
262 262
263 263 $ shortlog
264 264 o 1:2978fd5c8aa4 test 0 0 - default - patch
265 265 |
266 266 o 0:a0e19e636a43 test 0 0 - default - t
267 267
268 #endif
@@ -1,1529 +1,1541 b''
1 $ "$TESTDIR/hghave" execbit || exit 80
2
3 1 $ checkundo()
4 2 > {
5 3 > if [ -f .hg/store/undo ]; then
6 4 > echo ".hg/store/undo still exists after $1"
7 5 > fi
8 6 > }
9 7
10 8 $ echo "[extensions]" >> $HGRCPATH
11 9 $ echo "mq=" >> $HGRCPATH
12 10
13 11 $ echo "[mq]" >> $HGRCPATH
14 12 $ echo "plain=true" >> $HGRCPATH
15 13
16 14
17 15 help
18 16
19 17 $ hg help mq
20 18 mq extension - manage a stack of patches
21 19
22 20 This extension lets you work with a stack of patches in a Mercurial
23 21 repository. It manages two stacks of patches - all known patches, and applied
24 22 patches (subset of known patches).
25 23
26 24 Known patches are represented as patch files in the .hg/patches directory.
27 25 Applied patches are both patch files and changesets.
28 26
29 27 Common tasks (use "hg help command" for more details):
30 28
31 29 create new patch qnew
32 30 import existing patch qimport
33 31
34 32 print patch series qseries
35 33 print applied patches qapplied
36 34
37 35 add known patch to applied stack qpush
38 36 remove patch from applied stack qpop
39 37 refresh contents of top applied patch qrefresh
40 38
41 39 By default, mq will automatically use git patches when required to avoid
42 40 losing file mode changes, copy records, binary files or empty files creations
43 41 or deletions. This behaviour can be configured with:
44 42
45 43 [mq]
46 44 git = auto/keep/yes/no
47 45
48 46 If set to 'keep', mq will obey the [diff] section configuration while
49 47 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
50 48 will override the [diff] section and always generate git or regular patches,
51 49 possibly losing data in the second case.
52 50
53 51 It may be desirable for mq changesets to be kept in the secret phase (see "hg
54 52 help phases"), which can be enabled with the following setting:
55 53
56 54 [mq]
57 55 secret = True
58 56
59 57 You will by default be managing a patch queue named "patches". You can create
60 58 other, independent patch queues with the "hg qqueue" command.
61 59
62 60 If the working directory contains uncommitted files, qpush, qpop and qgoto
63 61 abort immediately. If -f/--force is used, the changes are discarded. Setting:
64 62
65 63 [mq]
66 64 keepchanges = True
67 65
68 66 make them behave as if --keep-changes were passed, and non-conflicting local
69 67 changes will be tolerated and preserved. If incompatible options such as
70 68 -f/--force or --exact are passed, this setting is ignored.
71 69
72 70 list of commands:
73 71
74 72 qapplied print the patches already applied
75 73 qclone clone main and patch repository at same time
76 74 qdelete remove patches from queue
77 75 qdiff diff of the current patch and subsequent modifications
78 76 qfinish move applied patches into repository history
79 77 qfold fold the named patches into the current patch
80 78 qgoto push or pop patches until named patch is at top of stack
81 79 qguard set or print guards for a patch
82 80 qheader print the header of the topmost or specified patch
83 81 qimport import a patch or existing changeset
84 82 qnew create a new patch
85 83 qnext print the name of the next pushable patch
86 84 qpop pop the current patch off the stack
87 85 qprev print the name of the preceding applied patch
88 86 qpush push the next patch onto the stack
89 87 qqueue manage multiple patch queues
90 88 qrefresh update the current patch
91 89 qrename rename a patch
92 90 qselect set or print guarded patches to push
93 91 qseries print the entire series file
94 92 qtop print the name of the current patch
95 93 qunapplied print the patches not yet applied
96 94 strip strip changesets and all their descendants from the repository
97 95
98 96 use "hg -v help mq" to show builtin aliases and global options
99 97
100 98 $ hg init a
101 99 $ cd a
102 100 $ echo a > a
103 101 $ hg ci -Ama
104 102 adding a
105 103
106 104 $ hg clone . ../k
107 105 updating to branch default
108 106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 107
110 108 $ mkdir b
111 109 $ echo z > b/z
112 110 $ hg ci -Ama
113 111 adding b/z
114 112
115 113
116 114 qinit
117 115
118 116 $ hg qinit
119 117
120 118 $ cd ..
121 119 $ hg init b
122 120
123 121
124 122 -R qinit
125 123
126 124 $ hg -R b qinit
127 125
128 126 $ hg init c
129 127
130 128
131 129 qinit -c
132 130
133 131 $ hg --cwd c qinit -c
134 132 $ hg -R c/.hg/patches st
135 133 A .hgignore
136 134 A series
137 135
138 136
139 137 qinit; qinit -c
140 138
141 139 $ hg init d
142 140 $ cd d
143 141 $ hg qinit
144 142 $ hg qinit -c
145 143
146 144 qinit -c should create both files if they don't exist
147 145
148 146 $ cat .hg/patches/.hgignore
149 147 ^\.hg
150 148 ^\.mq
151 149 syntax: glob
152 150 status
153 151 guards
154 152 $ cat .hg/patches/series
155 153 $ hg qinit -c
156 154 abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
157 155 [255]
158 156 $ cd ..
159 157
160 158 $ echo '% qinit; <stuff>; qinit -c'
161 159 % qinit; <stuff>; qinit -c
162 160 $ hg init e
163 161 $ cd e
164 162 $ hg qnew A
165 163 $ checkundo qnew
166 164 $ echo foo > foo
167 165 $ hg phase -r qbase
168 166 0: draft
169 167 $ hg add foo
170 168 $ hg qrefresh
171 169 $ hg phase -r qbase
172 170 0: draft
173 171 $ hg qnew B
174 172 $ echo >> foo
175 173 $ hg qrefresh
176 174 $ echo status >> .hg/patches/.hgignore
177 175 $ echo bleh >> .hg/patches/.hgignore
178 176 $ hg qinit -c
179 177 adding .hg/patches/A (glob)
180 178 adding .hg/patches/B (glob)
181 179 $ hg -R .hg/patches status
182 180 A .hgignore
183 181 A A
184 182 A B
185 183 A series
186 184
187 185 qinit -c shouldn't touch these files if they already exist
188 186
189 187 $ cat .hg/patches/.hgignore
190 188 status
191 189 bleh
192 190 $ cat .hg/patches/series
193 191 A
194 192 B
195 193
196 194 add an untracked file
197 195
198 196 $ echo >> .hg/patches/flaf
199 197
200 198 status --mq with color (issue2096)
201 199
202 200 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
203 201 \x1b[0;32;1mA .hgignore\x1b[0m (esc)
204 202 \x1b[0;32;1mA A\x1b[0m (esc)
205 203 \x1b[0;32;1mA B\x1b[0m (esc)
206 204 \x1b[0;32;1mA series\x1b[0m (esc)
207 205 \x1b[0;35;1;4m? flaf\x1b[0m (esc)
208 206
209 207 try the --mq option on a command provided by an extension
210 208
211 209 $ hg purge --mq --verbose --config extensions.purge=
212 210 Removing file flaf
213 211
214 212 $ cd ..
215 213
216 214 init --mq without repo
217 215
218 216 $ mkdir f
219 217 $ cd f
220 218 $ hg init --mq
221 219 abort: there is no Mercurial repository here (.hg not found)
222 220 [255]
223 221 $ cd ..
224 222
225 223 init --mq with repo path
226 224
227 225 $ hg init g
228 226 $ hg init --mq g
229 227 $ test -d g/.hg/patches/.hg
230 228
231 229 init --mq with nonexistent directory
232 230
233 231 $ hg init --mq nonexistentdir
234 232 abort: repository nonexistentdir not found!
235 233 [255]
236 234
237 235
238 236 init --mq with bundle (non "local")
239 237
240 238 $ hg -R a bundle --all a.bundle >/dev/null
241 239 $ hg init --mq a.bundle
242 240 abort: only a local queue repository may be initialized
243 241 [255]
244 242
245 243 $ cd a
246 244
247 245 $ hg qnew -m 'foo bar' test.patch
248 246
249 247 $ echo '# comment' > .hg/patches/series.tmp
250 248 $ echo >> .hg/patches/series.tmp # empty line
251 249 $ cat .hg/patches/series >> .hg/patches/series.tmp
252 250 $ mv .hg/patches/series.tmp .hg/patches/series
253 251
254 252
255 253 qrefresh
256 254
257 255 $ echo a >> a
258 256 $ hg qrefresh
259 257 $ cat .hg/patches/test.patch
260 258 foo bar
261 259
262 260 diff -r [a-f0-9]* a (re)
263 261 --- a/a\t(?P<date>.*) (re)
264 262 \+\+\+ b/a\t(?P<date2>.*) (re)
265 263 @@ -1,1 +1,2 @@
266 264 a
267 265 +a
268 266
269 267 empty qrefresh
270 268
271 269 $ hg qrefresh -X a
272 270
273 271 revision:
274 272
275 273 $ hg diff -r -2 -r -1
276 274
277 275 patch:
278 276
279 277 $ cat .hg/patches/test.patch
280 278 foo bar
281 279
282 280
283 281 working dir diff:
284 282
285 283 $ hg diff --nodates -q
286 284 --- a/a
287 285 +++ b/a
288 286 @@ -1,1 +1,2 @@
289 287 a
290 288 +a
291 289
292 290 restore things
293 291
294 292 $ hg qrefresh
295 293 $ checkundo qrefresh
296 294
297 295
298 296 qpop
299 297
300 298 $ hg qpop
301 299 popping test.patch
302 300 patch queue now empty
303 301 $ checkundo qpop
304 302
305 303
306 304 qpush with dump of tag cache
307 305 Dump the tag cache to ensure that it has exactly one head after qpush.
308 306
309 307 $ rm -f .hg/cache/tags
310 308 $ hg tags > /dev/null
311 309
312 310 .hg/cache/tags (pre qpush):
313 311
314 312 $ cat .hg/cache/tags
315 313 1 [\da-f]{40} (re)
316 314
317 315 $ hg qpush
318 316 applying test.patch
319 317 now at: test.patch
320 318 $ hg phase -r qbase
321 319 2: draft
322 320 $ hg tags > /dev/null
323 321
324 322 .hg/cache/tags (post qpush):
325 323
326 324 $ cat .hg/cache/tags
327 325 2 [\da-f]{40} (re)
328 326
329 327 $ checkundo qpush
330 328 $ cd ..
331 329
332 330
333 331 pop/push outside repo
334 332 $ hg -R a qpop
335 333 popping test.patch
336 334 patch queue now empty
337 335 $ hg -R a qpush
338 336 applying test.patch
339 337 now at: test.patch
340 338
341 339 $ cd a
342 340 $ hg qnew test2.patch
343 341
344 342 qrefresh in subdir
345 343
346 344 $ cd b
347 345 $ echo a > a
348 346 $ hg add a
349 347 $ hg qrefresh
350 348
351 349 pop/push -a in subdir
352 350
353 351 $ hg qpop -a
354 352 popping test2.patch
355 353 popping test.patch
356 354 patch queue now empty
357 355 $ hg --traceback qpush -a
358 356 applying test.patch
359 357 applying test2.patch
360 358 now at: test2.patch
361 359
362 360
363 361 setting columns & formatted tests truncating (issue1912)
364 362
365 363 $ COLUMNS=4 hg qseries --config ui.formatted=true
366 364 test.patch
367 365 test2.patch
368 366 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
369 367 0 A test.patch: f...
370 368 1 A test2.patch:
371 369 $ hg qpop
372 370 popping test2.patch
373 371 now at: test.patch
374 372 $ hg qseries -vs
375 373 0 A test.patch: foo bar
376 374 1 U test2.patch:
377 375 $ hg sum | grep mq
378 376 mq: 1 applied, 1 unapplied
379 377 $ hg qpush
380 378 applying test2.patch
381 379 now at: test2.patch
382 380 $ hg sum | grep mq
383 381 mq: 2 applied
384 382 $ hg qapplied
385 383 test.patch
386 384 test2.patch
387 385 $ hg qtop
388 386 test2.patch
389 387
390 388
391 389 prev
392 390
393 391 $ hg qapp -1
394 392 test.patch
395 393
396 394 next
397 395
398 396 $ hg qunapp -1
399 397 all patches applied
400 398 [1]
401 399
402 400 $ hg qpop
403 401 popping test2.patch
404 402 now at: test.patch
405 403
406 404 commit should fail
407 405
408 406 $ hg commit
409 407 abort: cannot commit over an applied mq patch
410 408 [255]
411 409
412 410 push should fail if draft
413 411
414 412 $ hg push ../../k
415 413 pushing to ../../k
416 414 abort: source has mq patches applied
417 415 [255]
418 416
419 417
420 418 import should fail
421 419
422 420 $ hg st .
423 421 $ echo foo >> ../a
424 422 $ hg diff > ../../import.diff
425 423 $ hg revert --no-backup ../a
426 424 $ hg import ../../import.diff
427 425 abort: cannot import over an applied patch
428 426 [255]
429 427 $ hg st
430 428
431 429 import --no-commit should succeed
432 430
433 431 $ hg import --no-commit ../../import.diff
434 432 applying ../../import.diff
435 433 $ hg st
436 434 M a
437 435 $ hg revert --no-backup ../a
438 436
439 437
440 438 qunapplied
441 439
442 440 $ hg qunapplied
443 441 test2.patch
444 442
445 443
446 444 qpush/qpop with index
447 445
448 446 $ hg qnew test1b.patch
449 447 $ echo 1b > 1b
450 448 $ hg add 1b
451 449 $ hg qrefresh
452 450 $ hg qpush 2
453 451 applying test2.patch
454 452 now at: test2.patch
455 453 $ hg qpop 0
456 454 popping test2.patch
457 455 popping test1b.patch
458 456 now at: test.patch
459 457 $ hg qpush test.patch+1
460 458 applying test1b.patch
461 459 now at: test1b.patch
462 460 $ hg qpush test.patch+2
463 461 applying test2.patch
464 462 now at: test2.patch
465 463 $ hg qpop test2.patch-1
466 464 popping test2.patch
467 465 now at: test1b.patch
468 466 $ hg qpop test2.patch-2
469 467 popping test1b.patch
470 468 now at: test.patch
471 469 $ hg qpush test1b.patch+1
472 470 applying test1b.patch
473 471 applying test2.patch
474 472 now at: test2.patch
475 473
476 474
477 475 qpush --move
478 476
479 477 $ hg qpop -a
480 478 popping test2.patch
481 479 popping test1b.patch
482 480 popping test.patch
483 481 patch queue now empty
484 482 $ hg qguard test1b.patch -- -negguard
485 483 $ hg qguard test2.patch -- +posguard
486 484 $ hg qpush --move test2.patch # can't move guarded patch
487 485 cannot push 'test2.patch' - guarded by '+posguard'
488 486 [1]
489 487 $ hg qselect posguard
490 488 number of unguarded, unapplied patches has changed from 2 to 3
491 489 $ hg qpush --move test2.patch # move to front
492 490 applying test2.patch
493 491 now at: test2.patch
494 492 $ hg qpush --move test1b.patch # negative guard unselected
495 493 applying test1b.patch
496 494 now at: test1b.patch
497 495 $ hg qpush --move test.patch # noop move
498 496 applying test.patch
499 497 now at: test.patch
500 498 $ hg qseries -v
501 499 0 A test2.patch
502 500 1 A test1b.patch
503 501 2 A test.patch
504 502 $ hg qpop -a
505 503 popping test.patch
506 504 popping test1b.patch
507 505 popping test2.patch
508 506 patch queue now empty
509 507
510 508 cleaning up
511 509
512 510 $ hg qselect --none
513 511 guards deactivated
514 512 number of unguarded, unapplied patches has changed from 3 to 2
515 513 $ hg qguard --none test1b.patch
516 514 $ hg qguard --none test2.patch
517 515 $ hg qpush --move test.patch
518 516 applying test.patch
519 517 now at: test.patch
520 518 $ hg qpush --move test1b.patch
521 519 applying test1b.patch
522 520 now at: test1b.patch
523 521 $ hg qpush --move bogus # nonexistent patch
524 522 abort: patch bogus not in series
525 523 [255]
526 524 $ hg qpush --move # no patch
527 525 abort: please specify the patch to move
528 526 [255]
529 527 $ hg qpush --move test.patch # already applied
530 528 abort: cannot push to a previous patch: test.patch
531 529 [255]
532 530 $ sed '2i\
533 531 > # make qtip index different in series and fullseries
534 532 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
535 533 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
536 534 $ cat `hg root`/.hg/patches/series
537 535 # comment
538 536 # make qtip index different in series and fullseries
539 537
540 538 test.patch
541 539 test1b.patch
542 540 test2.patch
543 541 $ hg qpush --move test2.patch
544 542 applying test2.patch
545 543 now at: test2.patch
546 544
547 545
548 546 series after move
549 547
550 548 $ cat `hg root`/.hg/patches/series
551 549 # comment
552 550 # make qtip index different in series and fullseries
553 551
554 552 test.patch
555 553 test1b.patch
556 554 test2.patch
557 555
558 556
559 557 pop, qapplied, qunapplied
560 558
561 559 $ hg qseries -v
562 560 0 A test.patch
563 561 1 A test1b.patch
564 562 2 A test2.patch
565 563
566 564 qapplied -1 test.patch
567 565
568 566 $ hg qapplied -1 test.patch
569 567 only one patch applied
570 568 [1]
571 569
572 570 qapplied -1 test1b.patch
573 571
574 572 $ hg qapplied -1 test1b.patch
575 573 test.patch
576 574
577 575 qapplied -1 test2.patch
578 576
579 577 $ hg qapplied -1 test2.patch
580 578 test1b.patch
581 579
582 580 qapplied -1
583 581
584 582 $ hg qapplied -1
585 583 test1b.patch
586 584
587 585 qapplied
588 586
589 587 $ hg qapplied
590 588 test.patch
591 589 test1b.patch
592 590 test2.patch
593 591
594 592 qapplied test1b.patch
595 593
596 594 $ hg qapplied test1b.patch
597 595 test.patch
598 596 test1b.patch
599 597
600 598 qunapplied -1
601 599
602 600 $ hg qunapplied -1
603 601 all patches applied
604 602 [1]
605 603
606 604 qunapplied
607 605
608 606 $ hg qunapplied
609 607
610 608 popping
611 609
612 610 $ hg qpop
613 611 popping test2.patch
614 612 now at: test1b.patch
615 613
616 614 qunapplied -1
617 615
618 616 $ hg qunapplied -1
619 617 test2.patch
620 618
621 619 qunapplied
622 620
623 621 $ hg qunapplied
624 622 test2.patch
625 623
626 624 qunapplied test2.patch
627 625
628 626 $ hg qunapplied test2.patch
629 627
630 628 qunapplied -1 test2.patch
631 629
632 630 $ hg qunapplied -1 test2.patch
633 631 all patches applied
634 632 [1]
635 633
636 634 popping -a
637 635
638 636 $ hg qpop -a
639 637 popping test1b.patch
640 638 popping test.patch
641 639 patch queue now empty
642 640
643 641 qapplied
644 642
645 643 $ hg qapplied
646 644
647 645 qapplied -1
648 646
649 647 $ hg qapplied -1
650 648 no patches applied
651 649 [1]
652 650 $ hg qpush
653 651 applying test.patch
654 652 now at: test.patch
655 653
656 654
657 655 push should succeed
658 656
659 657 $ hg qpop -a
660 658 popping test.patch
661 659 patch queue now empty
662 660 $ hg push ../../k
663 661 pushing to ../../k
664 662 searching for changes
665 663 adding changesets
666 664 adding manifests
667 665 adding file changes
668 666 added 1 changesets with 1 changes to 1 files
669 667
670 668
671 669 we want to start with some patches applied
672 670
673 671 $ hg qpush -a
674 672 applying test.patch
675 673 applying test1b.patch
676 674 applying test2.patch
677 675 now at: test2.patch
678 676
679 677 % pops all patches and succeeds
680 678
681 679 $ hg qpop -a
682 680 popping test2.patch
683 681 popping test1b.patch
684 682 popping test.patch
685 683 patch queue now empty
686 684
687 685 % does nothing and succeeds
688 686
689 687 $ hg qpop -a
690 688 no patches applied
691 689
692 690 % fails - nothing else to pop
693 691
694 692 $ hg qpop
695 693 no patches applied
696 694 [1]
697 695
698 696 % pushes a patch and succeeds
699 697
700 698 $ hg qpush
701 699 applying test.patch
702 700 now at: test.patch
703 701
704 702 % pops a patch and succeeds
705 703
706 704 $ hg qpop
707 705 popping test.patch
708 706 patch queue now empty
709 707
710 708 % pushes up to test1b.patch and succeeds
711 709
712 710 $ hg qpush test1b.patch
713 711 applying test.patch
714 712 applying test1b.patch
715 713 now at: test1b.patch
716 714
717 715 % does nothing and succeeds
718 716
719 717 $ hg qpush test1b.patch
720 718 qpush: test1b.patch is already at the top
721 719
722 720 % does nothing and succeeds
723 721
724 722 $ hg qpop test1b.patch
725 723 qpop: test1b.patch is already at the top
726 724
727 725 % fails - can't push to this patch
728 726
729 727 $ hg qpush test.patch
730 728 abort: cannot push to a previous patch: test.patch
731 729 [255]
732 730
733 731 % fails - can't pop to this patch
734 732
735 733 $ hg qpop test2.patch
736 734 abort: patch test2.patch is not applied
737 735 [255]
738 736
739 737 % pops up to test.patch and succeeds
740 738
741 739 $ hg qpop test.patch
742 740 popping test1b.patch
743 741 now at: test.patch
744 742
745 743 % pushes all patches and succeeds
746 744
747 745 $ hg qpush -a
748 746 applying test1b.patch
749 747 applying test2.patch
750 748 now at: test2.patch
751 749
752 750 % does nothing and succeeds
753 751
754 752 $ hg qpush -a
755 753 all patches are currently applied
756 754
757 755 % fails - nothing else to push
758 756
759 757 $ hg qpush
760 758 patch series already fully applied
761 759 [1]
762 760
763 761 % does nothing and succeeds
764 762
765 763 $ hg qpush test2.patch
766 764 qpush: test2.patch is already at the top
767 765
768 766 strip
769 767
770 768 $ cd ../../b
771 769 $ echo x>x
772 770 $ hg ci -Ama
773 771 adding x
774 772 $ hg strip tip
775 773 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
776 774 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
777 775 $ hg unbundle .hg/strip-backup/*
778 776 adding changesets
779 777 adding manifests
780 778 adding file changes
781 779 added 1 changesets with 1 changes to 1 files
782 780 (run 'hg update' to get a working copy)
783 781
784 782
785 783 strip with local changes, should complain
786 784
787 785 $ hg up
788 786 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
789 787 $ echo y>y
790 788 $ hg add y
791 789 $ hg strip tip
792 790 abort: local changes found
793 791 [255]
794 792
795 793 --force strip with local changes
796 794
797 795 $ hg strip -f tip
798 796 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
799 797 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
800 798
801 799
802 800 cd b; hg qrefresh
803 801
804 802 $ hg init refresh
805 803 $ cd refresh
806 804 $ echo a > a
807 805 $ hg ci -Ama
808 806 adding a
809 807 $ hg qnew -mfoo foo
810 808 $ echo a >> a
811 809 $ hg qrefresh
812 810 $ mkdir b
813 811 $ cd b
814 812 $ echo f > f
815 813 $ hg add f
816 814 $ hg qrefresh
817 815 $ cat ../.hg/patches/foo
818 816 foo
819 817
820 818 diff -r cb9a9f314b8b a
821 819 --- a/a\t(?P<date>.*) (re)
822 820 \+\+\+ b/a\t(?P<date>.*) (re)
823 821 @@ -1,1 +1,2 @@
824 822 a
825 823 +a
826 824 diff -r cb9a9f314b8b b/f
827 825 --- /dev/null\t(?P<date>.*) (re)
828 826 \+\+\+ b/b/f\t(?P<date>.*) (re)
829 827 @@ -0,0 +1,1 @@
830 828 +f
831 829
832 830 hg qrefresh .
833 831
834 832 $ hg qrefresh .
835 833 $ cat ../.hg/patches/foo
836 834 foo
837 835
838 836 diff -r cb9a9f314b8b b/f
839 837 --- /dev/null\t(?P<date>.*) (re)
840 838 \+\+\+ b/b/f\t(?P<date>.*) (re)
841 839 @@ -0,0 +1,1 @@
842 840 +f
843 841 $ hg status
844 842 M a
845 843
846 844
847 845 qpush failure
848 846
849 847 $ cd ..
850 848 $ hg qrefresh
851 849 $ hg qnew -mbar bar
852 850 $ echo foo > foo
853 851 $ echo bar > bar
854 852 $ hg add foo bar
855 853 $ hg qrefresh
856 854 $ hg qpop -a
857 855 popping bar
858 856 popping foo
859 857 patch queue now empty
860 858 $ echo bar > foo
861 859 $ hg qpush -a
862 860 applying foo
863 861 applying bar
864 862 file foo already exists
865 863 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
866 864 patch failed, unable to continue (try -v)
867 865 patch failed, rejects left in working dir
868 866 errors during apply, please fix and refresh bar
869 867 [2]
870 868 $ hg st
871 869 ? foo
872 870 ? foo.rej
873 871
874 872
875 873 mq tags
876 874
877 875 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
878 876 0 qparent
879 877 1 foo qbase
880 878 2 bar qtip tip
881 879
882 880 mq revset
883 881
884 882 $ hg log -r 'mq()' --template '{rev}\n'
885 883 1
886 884 2
887 885 $ hg help revsets | grep -i mq
888 886 "mq()"
889 887 Changesets managed by MQ.
890 888
891 889 bad node in status
892 890
893 891 $ hg qpop
894 892 popping bar
895 893 now at: foo
896 894 $ hg strip -qn tip
897 895 $ hg tip
898 896 changeset: 0:cb9a9f314b8b
899 897 tag: tip
900 898 user: test
901 899 date: Thu Jan 01 00:00:00 1970 +0000
902 900 summary: a
903 901
904 902 $ hg branches
905 903 default 0:cb9a9f314b8b
906 904 $ hg qpop
907 905 no patches applied
908 906 [1]
909 907
910 908 $ cat >>$HGRCPATH <<EOF
911 909 > [diff]
912 910 > git = True
913 911 > EOF
914 912 $ cd ..
915 913 $ hg init git
916 914 $ cd git
917 915 $ hg qinit
918 916
919 917 $ hg qnew -m'new file' new
920 918 $ echo foo > new
919 #if execbit
921 920 $ chmod +x new
921 #endif
922 922 $ hg add new
923 923 $ hg qrefresh
924 #if execbit
924 925 $ cat .hg/patches/new
925 926 new file
926 927
927 928 diff --git a/new b/new
928 929 new file mode 100755
929 930 --- /dev/null
930 931 +++ b/new
931 932 @@ -0,0 +1,1 @@
932 933 +foo
934 #else
935 $ cat .hg/patches/new
936 new file
937
938 diff --git a/new b/new
939 new file mode 100644
940 --- /dev/null
941 +++ b/new
942 @@ -0,0 +1,1 @@
943 +foo
944 #endif
933 945
934 946 $ hg qnew -m'copy file' copy
935 947 $ hg cp new copy
936 948 $ hg qrefresh
937 949 $ cat .hg/patches/copy
938 950 copy file
939 951
940 952 diff --git a/new b/copy
941 953 copy from new
942 954 copy to copy
943 955
944 956 $ hg qpop
945 957 popping copy
946 958 now at: new
947 959 $ hg qpush
948 960 applying copy
949 961 now at: copy
950 962 $ hg qdiff
951 963 diff --git a/new b/copy
952 964 copy from new
953 965 copy to copy
954 966 $ cat >>$HGRCPATH <<EOF
955 967 > [diff]
956 968 > git = False
957 969 > EOF
958 970 $ hg qdiff --git
959 971 diff --git a/new b/copy
960 972 copy from new
961 973 copy to copy
962 974 $ cd ..
963 975
964 976 empty lines in status
965 977
966 978 $ hg init emptystatus
967 979 $ cd emptystatus
968 980 $ hg qinit
969 981 $ printf '\n\n' > .hg/patches/status
970 982 $ hg qser
971 983 $ cd ..
972 984
973 985 bad line in status (without ":")
974 986
975 987 $ hg init badstatus
976 988 $ cd badstatus
977 989 $ hg qinit
978 990 $ printf 'babar has no colon in this line\n' > .hg/patches/status
979 991 $ hg qser
980 992 malformated mq status line: ['babar has no colon in this line']
981 993 $ cd ..
982 994
983 995
984 996 test file addition in slow path
985 997
986 998 $ hg init slow
987 999 $ cd slow
988 1000 $ hg qinit
989 1001 $ echo foo > foo
990 1002 $ hg add foo
991 1003 $ hg ci -m 'add foo'
992 1004 $ hg qnew bar
993 1005 $ echo bar > bar
994 1006 $ hg add bar
995 1007 $ hg mv foo baz
996 1008 $ hg qrefresh --git
997 1009 $ hg up -C 0
998 1010 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
999 1011 $ echo >> foo
1000 1012 $ hg ci -m 'change foo'
1001 1013 created new head
1002 1014 $ hg up -C 1
1003 1015 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1004 1016 $ hg qrefresh --git
1005 1017 $ cat .hg/patches/bar
1006 1018 diff --git a/bar b/bar
1007 1019 new file mode 100644
1008 1020 --- /dev/null
1009 1021 +++ b/bar
1010 1022 @@ -0,0 +1,1 @@
1011 1023 +bar
1012 1024 diff --git a/foo b/baz
1013 1025 rename from foo
1014 1026 rename to baz
1015 1027 $ hg log -v --template '{rev} {file_copies}\n' -r .
1016 1028 2 baz (foo)
1017 1029 $ hg qrefresh --git
1018 1030 $ cat .hg/patches/bar
1019 1031 diff --git a/bar b/bar
1020 1032 new file mode 100644
1021 1033 --- /dev/null
1022 1034 +++ b/bar
1023 1035 @@ -0,0 +1,1 @@
1024 1036 +bar
1025 1037 diff --git a/foo b/baz
1026 1038 rename from foo
1027 1039 rename to baz
1028 1040 $ hg log -v --template '{rev} {file_copies}\n' -r .
1029 1041 2 baz (foo)
1030 1042 $ hg qrefresh
1031 1043 $ grep 'diff --git' .hg/patches/bar
1032 1044 diff --git a/bar b/bar
1033 1045 diff --git a/foo b/baz
1034 1046
1035 1047
1036 1048 test file move chains in the slow path
1037 1049
1038 1050 $ hg up -C 1
1039 1051 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1040 1052 $ echo >> foo
1041 1053 $ hg ci -m 'change foo again'
1042 1054 $ hg up -C 2
1043 1055 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1044 1056 $ hg mv bar quux
1045 1057 $ hg mv baz bleh
1046 1058 $ hg qrefresh --git
1047 1059 $ cat .hg/patches/bar
1048 1060 diff --git a/foo b/bleh
1049 1061 rename from foo
1050 1062 rename to bleh
1051 1063 diff --git a/quux b/quux
1052 1064 new file mode 100644
1053 1065 --- /dev/null
1054 1066 +++ b/quux
1055 1067 @@ -0,0 +1,1 @@
1056 1068 +bar
1057 1069 $ hg log -v --template '{rev} {file_copies}\n' -r .
1058 1070 3 bleh (foo)
1059 1071 $ hg mv quux fred
1060 1072 $ hg mv bleh barney
1061 1073 $ hg qrefresh --git
1062 1074 $ cat .hg/patches/bar
1063 1075 diff --git a/foo b/barney
1064 1076 rename from foo
1065 1077 rename to barney
1066 1078 diff --git a/fred b/fred
1067 1079 new file mode 100644
1068 1080 --- /dev/null
1069 1081 +++ b/fred
1070 1082 @@ -0,0 +1,1 @@
1071 1083 +bar
1072 1084 $ hg log -v --template '{rev} {file_copies}\n' -r .
1073 1085 3 barney (foo)
1074 1086
1075 1087
1076 1088 refresh omitting an added file
1077 1089
1078 1090 $ hg qnew baz
1079 1091 $ echo newfile > newfile
1080 1092 $ hg add newfile
1081 1093 $ hg qrefresh
1082 1094 $ hg st -A newfile
1083 1095 C newfile
1084 1096 $ hg qrefresh -X newfile
1085 1097 $ hg st -A newfile
1086 1098 A newfile
1087 1099 $ hg revert newfile
1088 1100 $ rm newfile
1089 1101 $ hg qpop
1090 1102 popping baz
1091 1103 now at: bar
1092 1104 $ hg qdel baz
1093 1105
1094 1106
1095 1107 create a git patch
1096 1108
1097 1109 $ echo a > alexander
1098 1110 $ hg add alexander
1099 1111 $ hg qnew -f --git addalexander
1100 1112 $ grep diff .hg/patches/addalexander
1101 1113 diff --git a/alexander b/alexander
1102 1114
1103 1115
1104 1116 create a git binary patch
1105 1117
1106 1118 $ cat > writebin.py <<EOF
1107 1119 > import sys
1108 1120 > path = sys.argv[1]
1109 1121 > open(path, 'wb').write('BIN\x00ARY')
1110 1122 > EOF
1111 1123 $ python writebin.py bucephalus
1112 1124
1113 1125 $ python "$TESTDIR/md5sum.py" bucephalus
1114 1126 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1115 1127 $ hg add bucephalus
1116 1128 $ hg qnew -f --git addbucephalus
1117 1129 $ grep diff .hg/patches/addbucephalus
1118 1130 diff --git a/bucephalus b/bucephalus
1119 1131
1120 1132
1121 1133 check binary patches can be popped and pushed
1122 1134
1123 1135 $ hg qpop
1124 1136 popping addbucephalus
1125 1137 now at: addalexander
1126 1138 $ test -f bucephalus && echo % bucephalus should not be there
1127 1139 [1]
1128 1140 $ hg qpush
1129 1141 applying addbucephalus
1130 1142 now at: addbucephalus
1131 1143 $ test -f bucephalus
1132 1144 $ python "$TESTDIR/md5sum.py" bucephalus
1133 1145 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1134 1146
1135 1147
1136 1148
1137 1149 strip again
1138 1150
1139 1151 $ cd ..
1140 1152 $ hg init strip
1141 1153 $ cd strip
1142 1154 $ touch foo
1143 1155 $ hg add foo
1144 1156 $ hg ci -m 'add foo'
1145 1157 $ echo >> foo
1146 1158 $ hg ci -m 'change foo 1'
1147 1159 $ hg up -C 0
1148 1160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1149 1161 $ echo 1 >> foo
1150 1162 $ hg ci -m 'change foo 2'
1151 1163 created new head
1152 1164 $ HGMERGE=true hg merge
1153 1165 merging foo
1154 1166 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1155 1167 (branch merge, don't forget to commit)
1156 1168 $ hg ci -m merge
1157 1169 $ hg log
1158 1170 changeset: 3:99615015637b
1159 1171 tag: tip
1160 1172 parent: 2:20cbbe65cff7
1161 1173 parent: 1:d2871fc282d4
1162 1174 user: test
1163 1175 date: Thu Jan 01 00:00:00 1970 +0000
1164 1176 summary: merge
1165 1177
1166 1178 changeset: 2:20cbbe65cff7
1167 1179 parent: 0:53245c60e682
1168 1180 user: test
1169 1181 date: Thu Jan 01 00:00:00 1970 +0000
1170 1182 summary: change foo 2
1171 1183
1172 1184 changeset: 1:d2871fc282d4
1173 1185 user: test
1174 1186 date: Thu Jan 01 00:00:00 1970 +0000
1175 1187 summary: change foo 1
1176 1188
1177 1189 changeset: 0:53245c60e682
1178 1190 user: test
1179 1191 date: Thu Jan 01 00:00:00 1970 +0000
1180 1192 summary: add foo
1181 1193
1182 1194 $ hg strip 1
1183 1195 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1184 1196 saved backup bundle to $TESTTMP/b/strip/.hg/strip-backup/*-backup.hg (glob)
1185 1197 $ checkundo strip
1186 1198 $ hg log
1187 1199 changeset: 1:20cbbe65cff7
1188 1200 tag: tip
1189 1201 user: test
1190 1202 date: Thu Jan 01 00:00:00 1970 +0000
1191 1203 summary: change foo 2
1192 1204
1193 1205 changeset: 0:53245c60e682
1194 1206 user: test
1195 1207 date: Thu Jan 01 00:00:00 1970 +0000
1196 1208 summary: add foo
1197 1209
1198 1210 $ cd ..
1199 1211
1200 1212
1201 1213 qclone
1202 1214
1203 1215 $ qlog()
1204 1216 > {
1205 1217 > echo 'main repo:'
1206 1218 > hg log --template ' rev {rev}: {desc}\n'
1207 1219 > echo 'patch repo:'
1208 1220 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1209 1221 > }
1210 1222 $ hg init qclonesource
1211 1223 $ cd qclonesource
1212 1224 $ echo foo > foo
1213 1225 $ hg add foo
1214 1226 $ hg ci -m 'add foo'
1215 1227 $ hg qinit
1216 1228 $ hg qnew patch1
1217 1229 $ echo bar >> foo
1218 1230 $ hg qrefresh -m 'change foo'
1219 1231 $ cd ..
1220 1232
1221 1233
1222 1234 repo with unversioned patch dir
1223 1235
1224 1236 $ hg qclone qclonesource failure
1225 1237 abort: versioned patch repository not found (see init --mq)
1226 1238 [255]
1227 1239
1228 1240 $ cd qclonesource
1229 1241 $ hg qinit -c
1230 1242 adding .hg/patches/patch1 (glob)
1231 1243 $ hg qci -m checkpoint
1232 1244 $ qlog
1233 1245 main repo:
1234 1246 rev 1: change foo
1235 1247 rev 0: add foo
1236 1248 patch repo:
1237 1249 rev 0: checkpoint
1238 1250 $ cd ..
1239 1251
1240 1252
1241 1253 repo with patches applied
1242 1254
1243 1255 $ hg qclone qclonesource qclonedest
1244 1256 updating to branch default
1245 1257 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1246 1258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1247 1259 $ cd qclonedest
1248 1260 $ qlog
1249 1261 main repo:
1250 1262 rev 0: add foo
1251 1263 patch repo:
1252 1264 rev 0: checkpoint
1253 1265 $ cd ..
1254 1266
1255 1267
1256 1268 repo with patches unapplied
1257 1269
1258 1270 $ cd qclonesource
1259 1271 $ hg qpop -a
1260 1272 popping patch1
1261 1273 patch queue now empty
1262 1274 $ qlog
1263 1275 main repo:
1264 1276 rev 0: add foo
1265 1277 patch repo:
1266 1278 rev 0: checkpoint
1267 1279 $ cd ..
1268 1280 $ hg qclone qclonesource qclonedest2
1269 1281 updating to branch default
1270 1282 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1271 1283 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1272 1284 $ cd qclonedest2
1273 1285 $ qlog
1274 1286 main repo:
1275 1287 rev 0: add foo
1276 1288 patch repo:
1277 1289 rev 0: checkpoint
1278 1290 $ cd ..
1279 1291
1280 1292
1281 1293 Issue1033: test applying on an empty file
1282 1294
1283 1295 $ hg init empty
1284 1296 $ cd empty
1285 1297 $ touch a
1286 1298 $ hg ci -Am addempty
1287 1299 adding a
1288 1300 $ echo a > a
1289 1301 $ hg qnew -f -e changea
1290 1302 $ hg qpop
1291 1303 popping changea
1292 1304 patch queue now empty
1293 1305 $ hg qpush
1294 1306 applying changea
1295 1307 now at: changea
1296 1308 $ cd ..
1297 1309
1298 1310 test qpush with --force, issue1087
1299 1311
1300 1312 $ hg init forcepush
1301 1313 $ cd forcepush
1302 1314 $ echo hello > hello.txt
1303 1315 $ echo bye > bye.txt
1304 1316 $ hg ci -Ama
1305 1317 adding bye.txt
1306 1318 adding hello.txt
1307 1319 $ hg qnew -d '0 0' empty
1308 1320 $ hg qpop
1309 1321 popping empty
1310 1322 patch queue now empty
1311 1323 $ echo world >> hello.txt
1312 1324
1313 1325
1314 1326 qpush should fail, local changes
1315 1327
1316 1328 $ hg qpush
1317 1329 abort: local changes found
1318 1330 [255]
1319 1331
1320 1332
1321 1333 apply force, should not discard changes with empty patch
1322 1334
1323 1335 $ hg qpush -f
1324 1336 applying empty
1325 1337 patch empty is empty
1326 1338 now at: empty
1327 1339 $ hg diff --config diff.nodates=True
1328 1340 diff -r d58265112590 hello.txt
1329 1341 --- a/hello.txt
1330 1342 +++ b/hello.txt
1331 1343 @@ -1,1 +1,2 @@
1332 1344 hello
1333 1345 +world
1334 1346 $ hg qdiff --config diff.nodates=True
1335 1347 diff -r 9ecee4f634e3 hello.txt
1336 1348 --- a/hello.txt
1337 1349 +++ b/hello.txt
1338 1350 @@ -1,1 +1,2 @@
1339 1351 hello
1340 1352 +world
1341 1353 $ hg log -l1 -p
1342 1354 changeset: 1:d58265112590
1343 1355 tag: empty
1344 1356 tag: qbase
1345 1357 tag: qtip
1346 1358 tag: tip
1347 1359 user: test
1348 1360 date: Thu Jan 01 00:00:00 1970 +0000
1349 1361 summary: imported patch empty
1350 1362
1351 1363
1352 1364 $ hg qref -d '0 0'
1353 1365 $ hg qpop
1354 1366 popping empty
1355 1367 patch queue now empty
1356 1368 $ echo universe >> hello.txt
1357 1369 $ echo universe >> bye.txt
1358 1370
1359 1371
1360 1372 qpush should fail, local changes
1361 1373
1362 1374 $ hg qpush
1363 1375 abort: local changes found
1364 1376 [255]
1365 1377
1366 1378
1367 1379 apply force, should discard changes in hello, but not bye
1368 1380
1369 1381 $ hg qpush -f --verbose
1370 1382 applying empty
1371 1383 saving current version of hello.txt as hello.txt.orig
1372 1384 patching file hello.txt
1373 1385 hello.txt
1374 1386 now at: empty
1375 1387 $ hg st
1376 1388 M bye.txt
1377 1389 ? hello.txt.orig
1378 1390 $ hg diff --config diff.nodates=True
1379 1391 diff -r ba252371dbc1 bye.txt
1380 1392 --- a/bye.txt
1381 1393 +++ b/bye.txt
1382 1394 @@ -1,1 +1,2 @@
1383 1395 bye
1384 1396 +universe
1385 1397 $ hg qdiff --config diff.nodates=True
1386 1398 diff -r 9ecee4f634e3 bye.txt
1387 1399 --- a/bye.txt
1388 1400 +++ b/bye.txt
1389 1401 @@ -1,1 +1,2 @@
1390 1402 bye
1391 1403 +universe
1392 1404 diff -r 9ecee4f634e3 hello.txt
1393 1405 --- a/hello.txt
1394 1406 +++ b/hello.txt
1395 1407 @@ -1,1 +1,3 @@
1396 1408 hello
1397 1409 +world
1398 1410 +universe
1399 1411
1400 1412
1401 1413 test popping revisions not in working dir ancestry
1402 1414
1403 1415 $ hg qseries -v
1404 1416 0 A empty
1405 1417 $ hg up qparent
1406 1418 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1407 1419 $ hg qpop
1408 1420 popping empty
1409 1421 patch queue now empty
1410 1422
1411 1423 $ cd ..
1412 1424 $ hg init deletion-order
1413 1425 $ cd deletion-order
1414 1426
1415 1427 $ touch a
1416 1428 $ hg ci -Aqm0
1417 1429
1418 1430 $ hg qnew rename-dir
1419 1431 $ hg rm a
1420 1432 $ hg qrefresh
1421 1433
1422 1434 $ mkdir a b
1423 1435 $ touch a/a b/b
1424 1436 $ hg add -q a b
1425 1437 $ hg qrefresh
1426 1438
1427 1439
1428 1440 test popping must remove files added in subdirectories first
1429 1441
1430 1442 $ hg qpop
1431 1443 popping rename-dir
1432 1444 patch queue now empty
1433 1445 $ cd ..
1434 1446
1435 1447
1436 1448 test case preservation through patch pushing especially on case
1437 1449 insensitive filesystem
1438 1450
1439 1451 $ hg init casepreserve
1440 1452 $ cd casepreserve
1441 1453
1442 1454 $ hg qnew add-file1
1443 1455 $ echo a > TeXtFiLe.TxT
1444 1456 $ hg add TeXtFiLe.TxT
1445 1457 $ hg qrefresh
1446 1458
1447 1459 $ hg qnew add-file2
1448 1460 $ echo b > AnOtHeRFiLe.TxT
1449 1461 $ hg add AnOtHeRFiLe.TxT
1450 1462 $ hg qrefresh
1451 1463
1452 1464 $ hg qnew modify-file
1453 1465 $ echo c >> AnOtHeRFiLe.TxT
1454 1466 $ hg qrefresh
1455 1467
1456 1468 $ hg qapplied
1457 1469 add-file1
1458 1470 add-file2
1459 1471 modify-file
1460 1472 $ hg qpop -a
1461 1473 popping modify-file
1462 1474 popping add-file2
1463 1475 popping add-file1
1464 1476 patch queue now empty
1465 1477
1466 1478 this qpush causes problems below, if case preservation on case
1467 1479 insensitive filesystem is not enough:
1468 1480 (1) unexpected "adding ..." messages are shown
1469 1481 (2) patching fails in modification of (1) files
1470 1482
1471 1483 $ hg qpush -a
1472 1484 applying add-file1
1473 1485 applying add-file2
1474 1486 applying modify-file
1475 1487 now at: modify-file
1476 1488
1477 1489 Proper phase default with mq:
1478 1490
1479 1491 1. mq.secret=false
1480 1492
1481 1493 $ rm .hg/store/phaseroots
1482 1494 $ hg phase 'qparent::'
1483 1495 0: draft
1484 1496 1: draft
1485 1497 2: draft
1486 1498 $ echo '[mq]' >> $HGRCPATH
1487 1499 $ echo 'secret=true' >> $HGRCPATH
1488 1500 $ rm -f .hg/store/phaseroots
1489 1501 $ hg phase 'qparent::'
1490 1502 0: secret
1491 1503 1: secret
1492 1504 2: secret
1493 1505
1494 1506 Test that qfinish change phase when mq.secret=true
1495 1507
1496 1508 $ hg qfinish qbase
1497 1509 patch add-file1 finalized without changeset message
1498 1510 $ hg phase 'all()'
1499 1511 0: draft
1500 1512 1: secret
1501 1513 2: secret
1502 1514
1503 1515 Test that qfinish respect phases.new-commit setting
1504 1516
1505 1517 $ echo '[phases]' >> $HGRCPATH
1506 1518 $ echo 'new-commit=secret' >> $HGRCPATH
1507 1519 $ hg qfinish qbase
1508 1520 patch add-file2 finalized without changeset message
1509 1521 $ hg phase 'all()'
1510 1522 0: draft
1511 1523 1: secret
1512 1524 2: secret
1513 1525
1514 1526 (restore env for next test)
1515 1527
1516 1528 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1517 1529 $ cp $TESTTMP/sedtmp $HGRCPATH
1518 1530 $ hg qimport -r 1 --name add-file2
1519 1531
1520 1532 Test that qfinish preserve phase when mq.secret=false
1521 1533
1522 1534 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1523 1535 $ cp $TESTTMP/sedtmp $HGRCPATH
1524 1536 $ hg qfinish qbase
1525 1537 patch add-file2 finalized without changeset message
1526 1538 $ hg phase 'all()'
1527 1539 0: draft
1528 1540 1: secret
1529 1541 2: secret
@@ -1,1113 +1,1227 b''
1 1 $ "$TESTDIR/hghave" execbit || exit 80
2 2
3 3 Set up a repo
4 4
5 5 $ echo "[ui]" >> $HGRCPATH
6 6 $ echo "interactive=true" >> $HGRCPATH
7 7 $ echo "[extensions]" >> $HGRCPATH
8 8 $ echo "record=" >> $HGRCPATH
9 9
10 10 $ hg init a
11 11 $ cd a
12 12
13 13 Select no files
14 14
15 15 $ touch empty-rw
16 16 $ hg add empty-rw
17 17
18 18 $ hg record empty-rw<<EOF
19 19 > n
20 20 > EOF
21 21 diff --git a/empty-rw b/empty-rw
22 22 new file mode 100644
23 23 examine changes to 'empty-rw'? [Ynesfdaq?]
24 24 no changes to record
25 25
26 26 $ hg tip -p
27 27 changeset: -1:000000000000
28 28 tag: tip
29 29 user:
30 30 date: Thu Jan 01 00:00:00 1970 +0000
31 31
32 32
33 33
34 34 Select files but no hunks
35 35
36 36 $ hg record empty-rw<<EOF
37 37 > y
38 38 > n
39 39 > EOF
40 40 diff --git a/empty-rw b/empty-rw
41 41 new file mode 100644
42 42 examine changes to 'empty-rw'? [Ynesfdaq?]
43 43 abort: empty commit message
44 44 [255]
45 45
46 46 $ hg tip -p
47 47 changeset: -1:000000000000
48 48 tag: tip
49 49 user:
50 50 date: Thu Jan 01 00:00:00 1970 +0000
51 51
52 52
53 53
54 54 Record empty file
55 55
56 56 $ hg record -d '0 0' -m empty empty-rw<<EOF
57 57 > y
58 58 > y
59 59 > EOF
60 60 diff --git a/empty-rw b/empty-rw
61 61 new file mode 100644
62 62 examine changes to 'empty-rw'? [Ynesfdaq?]
63 63
64 64 $ hg tip -p
65 65 changeset: 0:c0708cf4e46e
66 66 tag: tip
67 67 user: test
68 68 date: Thu Jan 01 00:00:00 1970 +0000
69 69 summary: empty
70 70
71 71
72 72
73 73 Summary shows we updated to the new cset
74 74
75 75 $ hg summary
76 76 parent: 0:c0708cf4e46e tip
77 77 empty
78 78 branch: default
79 79 commit: (clean)
80 80 update: (current)
81 81
82 82 Rename empty file
83 83
84 84 $ hg mv empty-rw empty-rename
85 85 $ hg record -d '1 0' -m rename<<EOF
86 86 > y
87 87 > EOF
88 88 diff --git a/empty-rw b/empty-rename
89 89 rename from empty-rw
90 90 rename to empty-rename
91 91 examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?]
92 92
93 93 $ hg tip -p
94 94 changeset: 1:d695e8dcb197
95 95 tag: tip
96 96 user: test
97 97 date: Thu Jan 01 00:00:01 1970 +0000
98 98 summary: rename
99 99
100 100
101 101
102 102 Copy empty file
103 103
104 104 $ hg cp empty-rename empty-copy
105 105 $ hg record -d '2 0' -m copy<<EOF
106 106 > y
107 107 > EOF
108 108 diff --git a/empty-rename b/empty-copy
109 109 copy from empty-rename
110 110 copy to empty-copy
111 111 examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?]
112 112
113 113 $ hg tip -p
114 114 changeset: 2:1d4b90bea524
115 115 tag: tip
116 116 user: test
117 117 date: Thu Jan 01 00:00:02 1970 +0000
118 118 summary: copy
119 119
120 120
121 121
122 122 Delete empty file
123 123
124 124 $ hg rm empty-copy
125 125 $ hg record -d '3 0' -m delete<<EOF
126 126 > y
127 127 > EOF
128 128 diff --git a/empty-copy b/empty-copy
129 129 deleted file mode 100644
130 130 examine changes to 'empty-copy'? [Ynesfdaq?]
131 131
132 132 $ hg tip -p
133 133 changeset: 3:b39a238f01a1
134 134 tag: tip
135 135 user: test
136 136 date: Thu Jan 01 00:00:03 1970 +0000
137 137 summary: delete
138 138
139 139
140 140
141 141 Add binary file
142 142
143 143 $ hg bundle --base -2 tip.bundle
144 144 1 changesets found
145 145 $ hg add tip.bundle
146 146 $ hg record -d '4 0' -m binary<<EOF
147 147 > y
148 148 > EOF
149 149 diff --git a/tip.bundle b/tip.bundle
150 150 new file mode 100644
151 151 this is a binary file
152 152 examine changes to 'tip.bundle'? [Ynesfdaq?]
153 153
154 154 $ hg tip -p
155 155 changeset: 4:ad816da3711e
156 156 tag: tip
157 157 user: test
158 158 date: Thu Jan 01 00:00:04 1970 +0000
159 159 summary: binary
160 160
161 161 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
162 162 Binary file tip.bundle has changed
163 163
164 164
165 165 Change binary file
166 166
167 167 $ hg bundle --base -2 tip.bundle
168 168 1 changesets found
169 169 $ hg record -d '5 0' -m binary-change<<EOF
170 170 > y
171 171 > EOF
172 172 diff --git a/tip.bundle b/tip.bundle
173 173 this modifies a binary file (all or nothing)
174 174 examine changes to 'tip.bundle'? [Ynesfdaq?]
175 175
176 176 $ hg tip -p
177 177 changeset: 5:dccd6f3eb485
178 178 tag: tip
179 179 user: test
180 180 date: Thu Jan 01 00:00:05 1970 +0000
181 181 summary: binary-change
182 182
183 183 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
184 184 Binary file tip.bundle has changed
185 185
186 186
187 187 Rename and change binary file
188 188
189 189 $ hg mv tip.bundle top.bundle
190 190 $ hg bundle --base -2 top.bundle
191 191 1 changesets found
192 192 $ hg record -d '6 0' -m binary-change-rename<<EOF
193 193 > y
194 194 > EOF
195 195 diff --git a/tip.bundle b/top.bundle
196 196 rename from tip.bundle
197 197 rename to top.bundle
198 198 this modifies a binary file (all or nothing)
199 199 examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?]
200 200
201 201 $ hg tip -p
202 202 changeset: 6:7fa44105f5b3
203 203 tag: tip
204 204 user: test
205 205 date: Thu Jan 01 00:00:06 1970 +0000
206 206 summary: binary-change-rename
207 207
208 208 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
209 209 Binary file tip.bundle has changed
210 210 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
211 211 Binary file top.bundle has changed
212 212
213 213
214 214 Add plain file
215 215
216 216 $ for i in 1 2 3 4 5 6 7 8 9 10; do
217 217 > echo $i >> plain
218 218 > done
219 219
220 220 $ hg add plain
221 221 $ hg record -d '7 0' -m plain plain<<EOF
222 222 > y
223 223 > y
224 224 > EOF
225 225 diff --git a/plain b/plain
226 226 new file mode 100644
227 227 examine changes to 'plain'? [Ynesfdaq?]
228 228
229 229 $ hg tip -p
230 230 changeset: 7:11fb457c1be4
231 231 tag: tip
232 232 user: test
233 233 date: Thu Jan 01 00:00:07 1970 +0000
234 234 summary: plain
235 235
236 236 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
237 237 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
238 238 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
239 239 @@ -0,0 +1,10 @@
240 240 +1
241 241 +2
242 242 +3
243 243 +4
244 244 +5
245 245 +6
246 246 +7
247 247 +8
248 248 +9
249 249 +10
250 250
251 251
252 252 Modify end of plain file
253 253
254 254 $ echo 11 >> plain
255 255 $ hg record -d '8 0' -m end plain <<EOF
256 256 > y
257 257 > y
258 258 > EOF
259 259 diff --git a/plain b/plain
260 260 1 hunks, 1 lines changed
261 261 examine changes to 'plain'? [Ynesfdaq?]
262 262 @@ -8,3 +8,4 @@
263 263 8
264 264 9
265 265 10
266 266 +11
267 267 record this change to 'plain'? [Ynesfdaq?]
268 268
269 269 Modify end of plain file, no EOL
270 270
271 271 $ hg tip --template '{node}' >> plain
272 272 $ hg record -d '9 0' -m noeol plain <<EOF
273 273 > y
274 274 > y
275 275 > EOF
276 276 diff --git a/plain b/plain
277 277 1 hunks, 1 lines changed
278 278 examine changes to 'plain'? [Ynesfdaq?]
279 279 @@ -9,3 +9,4 @@
280 280 9
281 281 10
282 282 11
283 283 +7264f99c5f5ff3261504828afa4fb4d406c3af54
284 284 \ No newline at end of file
285 285 record this change to 'plain'? [Ynesfdaq?]
286 286
287 287 Modify end of plain file, add EOL
288 288
289 289 $ echo >> plain
290 290 $ echo 1 > plain2
291 291 $ hg add plain2
292 292 $ hg record -d '10 0' -m eol plain plain2 <<EOF
293 293 > y
294 294 > y
295 295 > y
296 296 > EOF
297 297 diff --git a/plain b/plain
298 298 1 hunks, 1 lines changed
299 299 examine changes to 'plain'? [Ynesfdaq?]
300 300 @@ -9,4 +9,4 @@
301 301 9
302 302 10
303 303 11
304 304 -7264f99c5f5ff3261504828afa4fb4d406c3af54
305 305 \ No newline at end of file
306 306 +7264f99c5f5ff3261504828afa4fb4d406c3af54
307 307 record change 1/2 to 'plain'? [Ynesfdaq?]
308 308 diff --git a/plain2 b/plain2
309 309 new file mode 100644
310 310 examine changes to 'plain2'? [Ynesfdaq?]
311 311
312 312 Modify beginning, trim end, record both, add another file to test
313 313 changes numbering
314 314
315 315 $ rm plain
316 316 $ for i in 2 2 3 4 5 6 7 8 9 10; do
317 317 > echo $i >> plain
318 318 > done
319 319 $ echo 2 >> plain2
320 320
321 321 $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF
322 322 > y
323 323 > y
324 324 > y
325 325 > y
326 326 > y
327 327 > EOF
328 328 diff --git a/plain b/plain
329 329 2 hunks, 3 lines changed
330 330 examine changes to 'plain'? [Ynesfdaq?]
331 331 @@ -1,4 +1,4 @@
332 332 -1
333 333 +2
334 334 2
335 335 3
336 336 4
337 337 record change 1/3 to 'plain'? [Ynesfdaq?]
338 338 @@ -8,5 +8,3 @@
339 339 8
340 340 9
341 341 10
342 342 -11
343 343 -7264f99c5f5ff3261504828afa4fb4d406c3af54
344 344 record change 2/3 to 'plain'? [Ynesfdaq?]
345 345 diff --git a/plain2 b/plain2
346 346 1 hunks, 1 lines changed
347 347 examine changes to 'plain2'? [Ynesfdaq?]
348 348 @@ -1,1 +1,2 @@
349 349 1
350 350 +2
351 351 record change 3/3 to 'plain2'? [Ynesfdaq?]
352 352
353 353 $ hg tip -p
354 354 changeset: 11:21df83db12b8
355 355 tag: tip
356 356 user: test
357 357 date: Thu Jan 01 00:00:10 1970 +0000
358 358 summary: begin-and-end
359 359
360 360 diff -r ddb8b281c3ff -r 21df83db12b8 plain
361 361 --- a/plain Thu Jan 01 00:00:10 1970 +0000
362 362 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
363 363 @@ -1,4 +1,4 @@
364 364 -1
365 365 +2
366 366 2
367 367 3
368 368 4
369 369 @@ -8,5 +8,3 @@
370 370 8
371 371 9
372 372 10
373 373 -11
374 374 -7264f99c5f5ff3261504828afa4fb4d406c3af54
375 375 diff -r ddb8b281c3ff -r 21df83db12b8 plain2
376 376 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
377 377 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
378 378 @@ -1,1 +1,2 @@
379 379 1
380 380 +2
381 381
382 382
383 383 Trim beginning, modify end
384 384
385 385 $ rm plain
386 386 > for i in 4 5 6 7 8 9 10.new; do
387 387 > echo $i >> plain
388 388 > done
389 389
390 390 Record end
391 391
392 392 $ hg record -d '11 0' -m end-only plain <<EOF
393 393 > y
394 394 > n
395 395 > y
396 396 > EOF
397 397 diff --git a/plain b/plain
398 398 2 hunks, 4 lines changed
399 399 examine changes to 'plain'? [Ynesfdaq?]
400 400 @@ -1,9 +1,6 @@
401 401 -2
402 402 -2
403 403 -3
404 404 4
405 405 5
406 406 6
407 407 7
408 408 8
409 409 9
410 410 record change 1/2 to 'plain'? [Ynesfdaq?]
411 411 @@ -4,7 +1,7 @@
412 412 4
413 413 5
414 414 6
415 415 7
416 416 8
417 417 9
418 418 -10
419 419 +10.new
420 420 record change 2/2 to 'plain'? [Ynesfdaq?]
421 421
422 422 $ hg tip -p
423 423 changeset: 12:99337501826f
424 424 tag: tip
425 425 user: test
426 426 date: Thu Jan 01 00:00:11 1970 +0000
427 427 summary: end-only
428 428
429 429 diff -r 21df83db12b8 -r 99337501826f plain
430 430 --- a/plain Thu Jan 01 00:00:10 1970 +0000
431 431 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
432 432 @@ -7,4 +7,4 @@
433 433 7
434 434 8
435 435 9
436 436 -10
437 437 +10.new
438 438
439 439
440 440 Record beginning
441 441
442 442 $ hg record -d '12 0' -m begin-only plain <<EOF
443 443 > y
444 444 > y
445 445 > EOF
446 446 diff --git a/plain b/plain
447 447 1 hunks, 3 lines changed
448 448 examine changes to 'plain'? [Ynesfdaq?]
449 449 @@ -1,6 +1,3 @@
450 450 -2
451 451 -2
452 452 -3
453 453 4
454 454 5
455 455 6
456 456 record this change to 'plain'? [Ynesfdaq?]
457 457
458 458 $ hg tip -p
459 459 changeset: 13:bbd45465d540
460 460 tag: tip
461 461 user: test
462 462 date: Thu Jan 01 00:00:12 1970 +0000
463 463 summary: begin-only
464 464
465 465 diff -r 99337501826f -r bbd45465d540 plain
466 466 --- a/plain Thu Jan 01 00:00:11 1970 +0000
467 467 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
468 468 @@ -1,6 +1,3 @@
469 469 -2
470 470 -2
471 471 -3
472 472 4
473 473 5
474 474 6
475 475
476 476
477 477 Add to beginning, trim from end
478 478
479 479 $ rm plain
480 480 $ for i in 1 2 3 4 5 6 7 8 9; do
481 481 > echo $i >> plain
482 482 > done
483 483
484 484 Record end
485 485
486 486 $ hg record --traceback -d '13 0' -m end-again plain<<EOF
487 487 > y
488 488 > n
489 489 > y
490 490 > EOF
491 491 diff --git a/plain b/plain
492 492 2 hunks, 4 lines changed
493 493 examine changes to 'plain'? [Ynesfdaq?]
494 494 @@ -1,6 +1,9 @@
495 495 +1
496 496 +2
497 497 +3
498 498 4
499 499 5
500 500 6
501 501 7
502 502 8
503 503 9
504 504 record change 1/2 to 'plain'? [Ynesfdaq?]
505 505 @@ -1,7 +4,6 @@
506 506 4
507 507 5
508 508 6
509 509 7
510 510 8
511 511 9
512 512 -10.new
513 513 record change 2/2 to 'plain'? [Ynesfdaq?]
514 514
515 515 Add to beginning, middle, end
516 516
517 517 $ rm plain
518 518 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
519 519 > echo $i >> plain
520 520 > done
521 521
522 522 Record beginning, middle
523 523
524 524 $ hg record -d '14 0' -m middle-only plain <<EOF
525 525 > y
526 526 > y
527 527 > y
528 528 > n
529 529 > EOF
530 530 diff --git a/plain b/plain
531 531 3 hunks, 7 lines changed
532 532 examine changes to 'plain'? [Ynesfdaq?]
533 533 @@ -1,2 +1,5 @@
534 534 +1
535 535 +2
536 536 +3
537 537 4
538 538 5
539 539 record change 1/3 to 'plain'? [Ynesfdaq?]
540 540 @@ -1,6 +4,8 @@
541 541 4
542 542 5
543 543 +5.new
544 544 +5.reallynew
545 545 6
546 546 7
547 547 8
548 548 9
549 549 record change 2/3 to 'plain'? [Ynesfdaq?]
550 550 @@ -3,4 +8,6 @@
551 551 6
552 552 7
553 553 8
554 554 9
555 555 +10
556 556 +11
557 557 record change 3/3 to 'plain'? [Ynesfdaq?]
558 558
559 559 $ hg tip -p
560 560 changeset: 15:f34a7937ec33
561 561 tag: tip
562 562 user: test
563 563 date: Thu Jan 01 00:00:14 1970 +0000
564 564 summary: middle-only
565 565
566 566 diff -r 82c065d0b850 -r f34a7937ec33 plain
567 567 --- a/plain Thu Jan 01 00:00:13 1970 +0000
568 568 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
569 569 @@ -1,5 +1,10 @@
570 570 +1
571 571 +2
572 572 +3
573 573 4
574 574 5
575 575 +5.new
576 576 +5.reallynew
577 577 6
578 578 7
579 579 8
580 580
581 581
582 582 Record end
583 583
584 584 $ hg record -d '15 0' -m end-only plain <<EOF
585 585 > y
586 586 > y
587 587 > EOF
588 588 diff --git a/plain b/plain
589 589 1 hunks, 2 lines changed
590 590 examine changes to 'plain'? [Ynesfdaq?]
591 591 @@ -9,3 +9,5 @@
592 592 7
593 593 8
594 594 9
595 595 +10
596 596 +11
597 597 record this change to 'plain'? [Ynesfdaq?]
598 598
599 599 $ hg tip -p
600 600 changeset: 16:f9900b71a04c
601 601 tag: tip
602 602 user: test
603 603 date: Thu Jan 01 00:00:15 1970 +0000
604 604 summary: end-only
605 605
606 606 diff -r f34a7937ec33 -r f9900b71a04c plain
607 607 --- a/plain Thu Jan 01 00:00:14 1970 +0000
608 608 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
609 609 @@ -9,3 +9,5 @@
610 610 7
611 611 8
612 612 9
613 613 +10
614 614 +11
615 615
616 616
617 617 $ mkdir subdir
618 618 $ cd subdir
619 619 $ echo a > a
620 620 $ hg ci -d '16 0' -Amsubdir
621 621 adding subdir/a
622 622
623 623 $ echo a >> a
624 624 $ hg record -d '16 0' -m subdir-change a <<EOF
625 625 > y
626 626 > y
627 627 > EOF
628 628 diff --git a/subdir/a b/subdir/a
629 629 1 hunks, 1 lines changed
630 630 examine changes to 'subdir/a'? [Ynesfdaq?]
631 631 @@ -1,1 +1,2 @@
632 632 a
633 633 +a
634 634 record this change to 'subdir/a'? [Ynesfdaq?]
635 635
636 636 $ hg tip -p
637 637 changeset: 18:61be427a9deb
638 638 tag: tip
639 639 user: test
640 640 date: Thu Jan 01 00:00:16 1970 +0000
641 641 summary: subdir-change
642 642
643 643 diff -r a7ffae4d61cb -r 61be427a9deb subdir/a
644 644 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
645 645 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
646 646 @@ -1,1 +1,2 @@
647 647 a
648 648 +a
649 649
650 650
651 651 $ echo a > f1
652 652 $ echo b > f2
653 653 $ hg add f1 f2
654 654
655 655 $ hg ci -mz -d '17 0'
656 656
657 657 $ echo a >> f1
658 658 $ echo b >> f2
659 659
660 660 Help, quit
661 661
662 662 $ hg record <<EOF
663 663 > ?
664 664 > q
665 665 > EOF
666 666 diff --git a/subdir/f1 b/subdir/f1
667 667 1 hunks, 1 lines changed
668 668 examine changes to 'subdir/f1'? [Ynesfdaq?]
669 669 y - record this change
670 670 n - skip this change
671 671 e - edit this change manually
672 672 s - skip remaining changes to this file
673 673 f - record remaining changes to this file
674 674 d - done, skip remaining changes and files
675 675 a - record all changes to all remaining files
676 676 q - quit, recording no changes
677 677 ? - display help
678 678 examine changes to 'subdir/f1'? [Ynesfdaq?]
679 679 abort: user quit
680 680 [255]
681 681
682 682 Skip
683 683
684 684 $ hg record <<EOF
685 685 > s
686 686 > EOF
687 687 diff --git a/subdir/f1 b/subdir/f1
688 688 1 hunks, 1 lines changed
689 689 examine changes to 'subdir/f1'? [Ynesfdaq?]
690 690 diff --git a/subdir/f2 b/subdir/f2
691 691 1 hunks, 1 lines changed
692 692 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
693 693 [255]
694 694
695 695 No
696 696
697 697 $ hg record <<EOF
698 698 > n
699 699 > EOF
700 700 diff --git a/subdir/f1 b/subdir/f1
701 701 1 hunks, 1 lines changed
702 702 examine changes to 'subdir/f1'? [Ynesfdaq?]
703 703 diff --git a/subdir/f2 b/subdir/f2
704 704 1 hunks, 1 lines changed
705 705 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
706 706 [255]
707 707
708 708 f, quit
709 709
710 710 $ hg record <<EOF
711 711 > f
712 712 > q
713 713 > EOF
714 714 diff --git a/subdir/f1 b/subdir/f1
715 715 1 hunks, 1 lines changed
716 716 examine changes to 'subdir/f1'? [Ynesfdaq?]
717 717 diff --git a/subdir/f2 b/subdir/f2
718 718 1 hunks, 1 lines changed
719 719 examine changes to 'subdir/f2'? [Ynesfdaq?]
720 720 abort: user quit
721 721 [255]
722 722
723 723 s, all
724 724
725 725 $ hg record -d '18 0' -mx <<EOF
726 726 > s
727 727 > a
728 728 > EOF
729 729 diff --git a/subdir/f1 b/subdir/f1
730 730 1 hunks, 1 lines changed
731 731 examine changes to 'subdir/f1'? [Ynesfdaq?]
732 732 diff --git a/subdir/f2 b/subdir/f2
733 733 1 hunks, 1 lines changed
734 734 examine changes to 'subdir/f2'? [Ynesfdaq?]
735 735
736 736 $ hg tip -p
737 737 changeset: 20:b3df3dda369a
738 738 tag: tip
739 739 user: test
740 740 date: Thu Jan 01 00:00:18 1970 +0000
741 741 summary: x
742 742
743 743 diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2
744 744 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
745 745 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
746 746 @@ -1,1 +1,2 @@
747 747 b
748 748 +b
749 749
750 750
751 751 f
752 752
753 753 $ hg record -d '19 0' -my <<EOF
754 754 > f
755 755 > EOF
756 756 diff --git a/subdir/f1 b/subdir/f1
757 757 1 hunks, 1 lines changed
758 758 examine changes to 'subdir/f1'? [Ynesfdaq?]
759 759
760 760 $ hg tip -p
761 761 changeset: 21:38ec577f126b
762 762 tag: tip
763 763 user: test
764 764 date: Thu Jan 01 00:00:19 1970 +0000
765 765 summary: y
766 766
767 767 diff -r b3df3dda369a -r 38ec577f126b subdir/f1
768 768 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
769 769 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
770 770 @@ -1,1 +1,2 @@
771 771 a
772 772 +a
773 773
774 774
775 #if execbit
776
775 777 Preserve chmod +x
776 778
777 779 $ chmod +x f1
778 780 $ echo a >> f1
779 781 $ hg record -d '20 0' -mz <<EOF
780 782 > y
781 783 > y
782 784 > y
783 785 > EOF
784 786 diff --git a/subdir/f1 b/subdir/f1
785 787 old mode 100644
786 788 new mode 100755
787 789 1 hunks, 1 lines changed
788 790 examine changes to 'subdir/f1'? [Ynesfdaq?]
789 791 @@ -1,2 +1,3 @@
790 792 a
791 793 a
792 794 +a
793 795 record this change to 'subdir/f1'? [Ynesfdaq?]
794 796
795 797 $ hg tip --config diff.git=True -p
796 798 changeset: 22:3261adceb075
797 799 tag: tip
798 800 user: test
799 801 date: Thu Jan 01 00:00:20 1970 +0000
800 802 summary: z
801 803
802 804 diff --git a/subdir/f1 b/subdir/f1
803 805 old mode 100644
804 806 new mode 100755
805 807 --- a/subdir/f1
806 808 +++ b/subdir/f1
807 809 @@ -1,2 +1,3 @@
808 810 a
809 811 a
810 812 +a
811 813
812 814
813 815 Preserve execute permission on original
814 816
815 817 $ echo b >> f1
816 818 $ hg record -d '21 0' -maa <<EOF
817 819 > y
818 820 > y
819 821 > y
820 822 > EOF
821 823 diff --git a/subdir/f1 b/subdir/f1
822 824 1 hunks, 1 lines changed
823 825 examine changes to 'subdir/f1'? [Ynesfdaq?]
824 826 @@ -1,3 +1,4 @@
825 827 a
826 828 a
827 829 a
828 830 +b
829 831 record this change to 'subdir/f1'? [Ynesfdaq?]
830 832
831 833 $ hg tip --config diff.git=True -p
832 834 changeset: 23:b429867550db
833 835 tag: tip
834 836 user: test
835 837 date: Thu Jan 01 00:00:21 1970 +0000
836 838 summary: aa
837 839
838 840 diff --git a/subdir/f1 b/subdir/f1
839 841 --- a/subdir/f1
840 842 +++ b/subdir/f1
841 843 @@ -1,3 +1,4 @@
842 844 a
843 845 a
844 846 a
845 847 +b
846 848
847 849
848 850 Preserve chmod -x
849 851
850 852 $ chmod -x f1
851 853 $ echo c >> f1
852 854 $ hg record -d '22 0' -mab <<EOF
853 855 > y
854 856 > y
855 857 > y
856 858 > EOF
857 859 diff --git a/subdir/f1 b/subdir/f1
858 860 old mode 100755
859 861 new mode 100644
860 862 1 hunks, 1 lines changed
861 863 examine changes to 'subdir/f1'? [Ynesfdaq?]
862 864 @@ -2,3 +2,4 @@
863 865 a
864 866 a
865 867 b
866 868 +c
867 869 record this change to 'subdir/f1'? [Ynesfdaq?]
868 870
869 871 $ hg tip --config diff.git=True -p
870 872 changeset: 24:0b082130c20a
871 873 tag: tip
872 874 user: test
873 875 date: Thu Jan 01 00:00:22 1970 +0000
874 876 summary: ab
875 877
876 878 diff --git a/subdir/f1 b/subdir/f1
877 879 old mode 100755
878 880 new mode 100644
879 881 --- a/subdir/f1
880 882 +++ b/subdir/f1
881 883 @@ -2,3 +2,4 @@
882 884 a
883 885 a
884 886 b
885 887 +c
886 888
887 889
890 #else
891
892 Slightly bogus tests to get almost same repo structure as when x bit is used
893 - but with different hashes.
894
895 Mock "Preserve chmod +x"
896
897 $ echo a >> f1
898 $ hg record -d '20 0' -mz <<EOF
899 > y
900 > y
901 > y
902 > EOF
903 diff --git a/subdir/f1 b/subdir/f1
904 1 hunks, 1 lines changed
905 examine changes to 'subdir/f1'? [Ynesfdaq?]
906 @@ -1,2 +1,3 @@
907 a
908 a
909 +a
910 record this change to 'subdir/f1'? [Ynesfdaq?]
911
912 $ hg tip --config diff.git=True -p
913 changeset: 22:0d463bd428f5
914 tag: tip
915 user: test
916 date: Thu Jan 01 00:00:20 1970 +0000
917 summary: z
918
919 diff --git a/subdir/f1 b/subdir/f1
920 --- a/subdir/f1
921 +++ b/subdir/f1
922 @@ -1,2 +1,3 @@
923 a
924 a
925 +a
926
927
928 Mock "Preserve execute permission on original"
929
930 $ echo b >> f1
931 $ hg record -d '21 0' -maa <<EOF
932 > y
933 > y
934 > y
935 > EOF
936 diff --git a/subdir/f1 b/subdir/f1
937 1 hunks, 1 lines changed
938 examine changes to 'subdir/f1'? [Ynesfdaq?]
939 @@ -1,3 +1,4 @@
940 a
941 a
942 a
943 +b
944 record this change to 'subdir/f1'? [Ynesfdaq?]
945
946 $ hg tip --config diff.git=True -p
947 changeset: 23:0eab41a3e524
948 tag: tip
949 user: test
950 date: Thu Jan 01 00:00:21 1970 +0000
951 summary: aa
952
953 diff --git a/subdir/f1 b/subdir/f1
954 --- a/subdir/f1
955 +++ b/subdir/f1
956 @@ -1,3 +1,4 @@
957 a
958 a
959 a
960 +b
961
962
963 Mock "Preserve chmod -x"
964
965 $ chmod -x f1
966 $ echo c >> f1
967 $ hg record -d '22 0' -mab <<EOF
968 > y
969 > y
970 > y
971 > EOF
972 diff --git a/subdir/f1 b/subdir/f1
973 1 hunks, 1 lines changed
974 examine changes to 'subdir/f1'? [Ynesfdaq?]
975 @@ -2,3 +2,4 @@
976 a
977 a
978 b
979 +c
980 record this change to 'subdir/f1'? [Ynesfdaq?]
981
982 $ hg tip --config diff.git=True -p
983 changeset: 24:f4f718f27b7c
984 tag: tip
985 user: test
986 date: Thu Jan 01 00:00:22 1970 +0000
987 summary: ab
988
989 diff --git a/subdir/f1 b/subdir/f1
990 --- a/subdir/f1
991 +++ b/subdir/f1
992 @@ -2,3 +2,4 @@
993 a
994 a
995 b
996 +c
997
998
999 #endif
1000
888 1001 $ cd ..
889 1002
1003
890 1004 Abort early when a merge is in progress
891 1005
892 1006 $ hg up 4
893 1007 1 files updated, 0 files merged, 6 files removed, 0 files unresolved
894 1008
895 1009 $ touch iwillmergethat
896 1010 $ hg add iwillmergethat
897 1011
898 1012 $ hg branch thatbranch
899 1013 marked working directory as branch thatbranch
900 1014 (branches are permanent and global, did you want a bookmark?)
901 1015
902 1016 $ hg ci -m'new head'
903 1017
904 1018 $ hg up default
905 1019 6 files updated, 0 files merged, 2 files removed, 0 files unresolved
906 1020
907 1021 $ hg merge thatbranch
908 1022 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
909 1023 (branch merge, don't forget to commit)
910 1024
911 1025 $ hg record -m'will abort'
912 1026 abort: cannot partially commit a merge (use "hg commit" instead)
913 1027 [255]
914 1028
915 1029 $ hg up -C
916 1030 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
917 1031
918 1032 Editing patch
919 1033
920 1034 $ cat > editor << '__EOF__'
921 1035 > #!/bin/sh
922 1036 > sed -e 7d -e '5s/^-/ /' "$1" > tmp
923 1037 > mv tmp "$1"
924 1038 > __EOF__
925 1039 $ chmod +x editor
926 1040 $ cat > editedfile << '__EOF__'
927 1041 > This is the first line
928 1042 > This is the second line
929 1043 > This is the third line
930 1044 > __EOF__
931 1045 $ hg add editedfile
932 1046 $ hg commit -medit-patch-1
933 1047 $ cat > editedfile << '__EOF__'
934 1048 > This line has changed
935 1049 > This change will be committed
936 1050 > This is the third line
937 1051 > __EOF__
938 1052 $ HGEDITOR="'`pwd`'"/editor hg record -d '23 0' -medit-patch-2 <<EOF
939 1053 > y
940 1054 > e
941 1055 > EOF
942 1056 diff --git a/editedfile b/editedfile
943 1057 1 hunks, 2 lines changed
944 1058 examine changes to 'editedfile'? [Ynesfdaq?]
945 1059 @@ -1,3 +1,3 @@
946 1060 -This is the first line
947 1061 -This is the second line
948 1062 +This line has changed
949 1063 +This change will be committed
950 1064 This is the third line
951 1065 record this change to 'editedfile'? [Ynesfdaq?]
952 1066 $ cat editedfile
953 1067 This line has changed
954 1068 This change will be committed
955 1069 This is the third line
956 1070 $ hg cat -r tip editedfile
957 1071 This is the first line
958 1072 This change will be committed
959 1073 This is the third line
960 1074 $ hg revert editedfile
961 1075
962 1076 Trying to edit patch for whole file
963 1077
964 1078 $ echo "This is the fourth line" >> editedfile
965 1079 $ hg record <<EOF
966 1080 > e
967 1081 > q
968 1082 > EOF
969 1083 diff --git a/editedfile b/editedfile
970 1084 1 hunks, 1 lines changed
971 1085 examine changes to 'editedfile'? [Ynesfdaq?]
972 1086 cannot edit patch for whole file
973 1087 examine changes to 'editedfile'? [Ynesfdaq?]
974 1088 abort: user quit
975 1089 [255]
976 1090 $ hg revert editedfile
977 1091
978 1092 Removing changes from patch
979 1093
980 1094 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
981 1095 $ mv tmp editedfile
982 1096 $ echo "This line has been added" >> editedfile
983 1097 $ cat > editor << '__EOF__'
984 1098 > #!/bin/sh
985 1099 > sed -e 's/^[-+]/ /' "$1" > tmp
986 1100 > mv tmp "$1"
987 1101 > __EOF__
988 1102 $ chmod +x editor
989 1103 $ HGEDITOR="'`pwd`'"/editor hg record <<EOF
990 1104 > y
991 1105 > e
992 1106 > EOF
993 1107 diff --git a/editedfile b/editedfile
994 1108 1 hunks, 3 lines changed
995 1109 examine changes to 'editedfile'? [Ynesfdaq?]
996 1110 @@ -1,3 +1,3 @@
997 1111 -This is the first line
998 1112 -This change will be committed
999 1113 -This is the third line
1000 1114 +This change will not be committed
1001 1115 +This is the second line
1002 1116 +This line has been added
1003 1117 record this change to 'editedfile'? [Ynesfdaq?]
1004 1118 no changes to record
1005 1119 $ cat editedfile
1006 1120 This change will not be committed
1007 1121 This is the second line
1008 1122 This line has been added
1009 1123 $ hg cat -r tip editedfile
1010 1124 This is the first line
1011 1125 This change will be committed
1012 1126 This is the third line
1013 1127 $ hg revert editedfile
1014 1128
1015 1129 Invalid patch
1016 1130
1017 1131 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
1018 1132 $ mv tmp editedfile
1019 1133 $ echo "This line has been added" >> editedfile
1020 1134 $ cat > editor << '__EOF__'
1021 1135 > #!/bin/sh
1022 1136 > sed s/This/That/ "$1" > tmp
1023 1137 > mv tmp "$1"
1024 1138 > __EOF__
1025 1139 $ chmod +x editor
1026 1140 $ HGEDITOR="'`pwd`'"/editor hg record <<EOF
1027 1141 > y
1028 1142 > e
1029 1143 > EOF
1030 1144 diff --git a/editedfile b/editedfile
1031 1145 1 hunks, 3 lines changed
1032 1146 examine changes to 'editedfile'? [Ynesfdaq?]
1033 1147 @@ -1,3 +1,3 @@
1034 1148 -This is the first line
1035 1149 -This change will be committed
1036 1150 -This is the third line
1037 1151 +This change will not be committed
1038 1152 +This is the second line
1039 1153 +This line has been added
1040 1154 record this change to 'editedfile'? [Ynesfdaq?]
1041 1155 patching file editedfile
1042 1156 Hunk #1 FAILED at 0
1043 1157 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej
1044 1158 abort: patch failed to apply
1045 1159 [255]
1046 1160 $ cat editedfile
1047 1161 This change will not be committed
1048 1162 This is the second line
1049 1163 This line has been added
1050 1164 $ hg cat -r tip editedfile
1051 1165 This is the first line
1052 1166 This change will be committed
1053 1167 This is the third line
1054 1168 $ cat editedfile.rej
1055 1169 --- editedfile
1056 1170 +++ editedfile
1057 1171 @@ -1,3 +1,3 @@
1058 1172 -That is the first line
1059 1173 -That change will be committed
1060 1174 -That is the third line
1061 1175 +That change will not be committed
1062 1176 +That is the second line
1063 1177 +That line has been added
1064 1178 $ hg up -C
1065 1179 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1066 1180
1067 1181 With win32text
1068 1182
1069 1183 $ echo '[extensions]' >> .hg/hgrc
1070 1184 $ echo 'win32text = ' >> .hg/hgrc
1071 1185 $ echo '[decode]' >> .hg/hgrc
1072 1186 $ echo '** = cleverdecode:' >> .hg/hgrc
1073 1187 $ echo '[encode]' >> .hg/hgrc
1074 1188 $ echo '** = cleverencode:' >> .hg/hgrc
1075 1189 $ echo '[patch]' >> .hg/hgrc
1076 1190 $ echo 'eol = crlf' >> .hg/hgrc
1077 1191
1078 1192 Ignore win32text deprecation warning for now:
1079 1193
1080 1194 $ echo '[win32text]' >> .hg/hgrc
1081 1195 $ echo 'warn = no' >> .hg/hgrc
1082 1196
1083 1197 $ echo d >> subdir/f1
1084 1198 $ hg record -d '24 0' -mw1 <<EOF
1085 1199 > y
1086 1200 > y
1087 1201 > EOF
1088 1202 diff --git a/subdir/f1 b/subdir/f1
1089 1203 1 hunks, 1 lines changed
1090 1204 examine changes to 'subdir/f1'? [Ynesfdaq?]
1091 1205 @@ -3,3 +3,4 @@
1092 1206 a
1093 1207 b
1094 1208 c
1095 1209 +d
1096 1210 record this change to 'subdir/f1'? [Ynesfdaq?]
1097 1211
1098 1212 $ hg tip -p
1099 changeset: 28:287ad1f41a72
1213 changeset: 28:* (glob)
1100 1214 tag: tip
1101 1215 user: test
1102 1216 date: Thu Jan 01 00:00:24 1970 +0000
1103 1217 summary: w1
1104 1218
1105 diff -r 65ce23a81197 -r 287ad1f41a72 subdir/f1
1219 diff -r ???????????? -r ???????????? subdir/f1 (glob)
1106 1220 --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
1107 1221 +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000
1108 1222 @@ -3,3 +3,4 @@
1109 1223 a
1110 1224 b
1111 1225 c
1112 1226 +d
1113 1227
General Comments 0
You need to be logged in to leave comments. Login now