##// END OF EJS Templates
merge with crew-stable
Alexis S. L. Carvalho -
r4782:37e11c76 merge default
parent child Browse files
Show More
@@ -466,18 +466,17 b' def docopy(ui, repo, pats, opts, wlock):'
466 466 # return: hgsep
467 467 def okaytocopy(abs, rel, exact):
468 468 reasons = {'?': _('is not managed'),
469 'a': _('has been marked for add'),
470 469 'r': _('has been marked for remove')}
471 470 state = repo.dirstate.state(abs)
472 471 reason = reasons.get(state)
473 472 if reason:
473 if exact:
474 ui.warn(_('%s: not copying - file %s\n') % (rel, reason))
475 else:
474 476 if state == 'a':
475 477 origsrc = repo.dirstate.copied(abs)
476 478 if origsrc is not None:
477 479 return origsrc
478 if exact:
479 ui.warn(_('%s: not copying - file %s\n') % (rel, reason))
480 else:
481 480 return abs
482 481
483 482 # origsrc: hgsep
@@ -532,8 +531,15 b' def docopy(ui, repo, pats, opts, wlock):'
532 531 if ui.verbose or not exact:
533 532 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
534 533 targets[abstarget] = abssrc
535 if abstarget != origsrc and not opts.get('dry_run'):
536 repo.copy(origsrc, abstarget, wlock)
534 if abstarget != origsrc:
535 if repo.dirstate.state(origsrc) == 'a':
536 ui.warn(_("%s was marked for addition. "
537 "%s will not be committed as a copy.\n")
538 % (repo.pathto(origsrc, cwd), reltarget))
539 if abstarget not in repo.dirstate and not opts.get('dry_run'):
540 repo.add([abstarget], wlock)
541 elif not opts.get('dry_run'):
542 repo.copy(origsrc, abstarget, wlock)
537 543 copied.append((abssrc, relsrc, exact))
538 544
539 545 # pat: ossep
@@ -404,7 +404,7 b' class hgweb(object):'
404 404 parent=self.siblings(fctx.parents()),
405 405 child=self.siblings(fctx.children()),
406 406 rename=self.renamelink(fl, n),
407 permissions=fctx.manifest().execf(f))
407 permissions=fctx.manifest().flags(f))
408 408
409 409 def fileannotate(self, fctx):
410 410 f = fctx.path()
@@ -440,7 +440,7 b' class hgweb(object):'
440 440 rename=self.renamelink(fl, n),
441 441 parent=self.siblings(fctx.parents()),
442 442 child=self.siblings(fctx.children()),
443 permissions=fctx.manifest().execf(f))
443 permissions=fctx.manifest().flags(f))
444 444
445 445 def manifest(self, ctx, path):
446 446 mf = ctx.manifest()
@@ -477,7 +477,7 b' class hgweb(object):'
477 477 "parity": parity.next(),
478 478 "basename": f,
479 479 "size": ctx.filectx(full).size(),
480 "permissions": mf.execf(full)}
480 "permissions": mf.flags(full)}
481 481
482 482 def dirlist(**map):
483 483 fl = files.keys()
@@ -245,6 +245,13 b' def indent(text, prefix):'
245 245 yield '\n'
246 246 return "".join(indenter())
247 247
248 def permissions(flags):
249 if "l" in flags:
250 return "lrwxrwxrwx"
251 if "x" in flags:
252 return "-rwxr-xr-x"
253 return "-rw-r--r--"
254
248 255 common_filters = {
249 256 "addbreaks": nl2br,
250 257 "basename": os.path.basename,
@@ -260,7 +267,7 b' common_filters = {'
260 267 "hgdate": hgdate,
261 268 "isodate": isodate,
262 269 "obfuscate": obfuscate,
263 "permissions": lambda x: x and "-rwxr-xr-x" or "-rw-r--r--",
270 "permissions": permissions,
264 271 "person": person,
265 272 "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"),
266 273 "short": lambda x: x[:12],
@@ -2,16 +2,33 b''
2 2
3 3 hg init
4 4 echo foo > foo
5 echo "# should fail - foo is not managed"
6 hg mv foo bar
7 hg st -A
5 8 hg add foo
9 echo "# dry-run; print a warning that this is not a real copy; foo is added"
10 hg mv --dry-run foo bar
11 hg st -A
12 echo "# should print a warning that this is not a real copy; bar is added"
13 hg mv foo bar
14 hg st -A
15 echo "# should print a warning that this is not a real copy; foo is added"
16 hg cp bar foo
17 hg rm -f bar
18 rm bar
19 hg st -A
6 20 hg commit -m1 -d"0 0"
7 21
22 echo "# dry-run; should show that foo is clean"
23 hg copy --dry-run foo bar
24 hg st -A
8 25 echo "# should show copy"
9 26 hg copy foo bar
10 hg debugstate|grep '^copy'
27 hg st -C
11 28
12 29 echo "# shouldn't show copy"
13 30 hg commit -m2 -d"0 0"
14 hg debugstate|grep '^copy'
31 hg st -C
15 32
16 33 echo "# should match"
17 34 hg debugindex .hg/store/data/foo.i
@@ -26,7 +43,7 b' hg debugrename bar'
26 43
27 44 hg copy -f foo bar
28 45 echo "# should show copy"
29 hg debugstate|grep '^copy'
46 hg st -C
30 47 hg commit -m3 -d"0 0"
31 48
32 49 echo "# should show no parents for tip"
@@ -36,7 +53,7 b' hg debugindex .hg/store/data/foo.i'
36 53 hg debugrename bar
37 54
38 55 echo "# should show no copies"
39 hg debugstate|grep '^copy'
56 hg st -C
40 57
41 58 echo "# copy --after on an added file"
42 59 cp bar baz
@@ -1,5 +1,21 b''
1 # should fail - foo is not managed
2 foo: not copying - file is not managed
3 abort: no files to copy
4 ? foo
5 # dry-run; print a warning that this is not a real copy; foo is added
6 foo was marked for addition. bar will not be committed as a copy.
7 A foo
8 # should print a warning that this is not a real copy; bar is added
9 foo was marked for addition. bar will not be committed as a copy.
10 A bar
11 # should print a warning that this is not a real copy; foo is added
12 bar was marked for addition. foo will not be committed as a copy.
13 A foo
14 # dry-run; should show that foo is clean
15 C foo
1 16 # should show copy
2 copy: foo -> bar
17 A bar
18 foo
3 19 # shouldn't show copy
4 20 # should match
5 21 rev offset length base linkrev nodeid p1 p2
@@ -8,7 +24,8 b' bar renamed from foo:2ed2a3912a0b2450204'
8 24 # should not be renamed
9 25 bar not renamed
10 26 # should show copy
11 copy: foo -> bar
27 M bar
28 foo
12 29 # should show no parents for tip
13 30 rev offset length base linkrev nodeid p1 p2
14 31 0 0 69 0 1 6ca237634e1f 000000000000 000000000000
@@ -12,79 +12,79 b' hg commit -m "1" -d "1000000 0"'
12 12
13 13 echo "# rename a single file"
14 14 hg rename d1/d11/a1 d2/c
15 hg status
15 hg status -C
16 16 hg update -C
17 17
18 18 echo "# rename --after a single file"
19 19 mv d1/d11/a1 d2/c
20 20 hg rename --after d1/d11/a1 d2/c
21 hg status
21 hg status -C
22 22 hg update -C
23 23
24 24 echo "# move a single file to an existing directory"
25 25 hg rename d1/d11/a1 d2
26 hg status
26 hg status -C
27 27 hg update -C
28 28
29 29 echo "# move --after a single file to an existing directory"
30 30 mv d1/d11/a1 d2
31 31 hg rename --after d1/d11/a1 d2
32 hg status
32 hg status -C
33 33 hg update -C
34 34
35 35 echo "# rename a file using a relative path"
36 36 (cd d1/d11; hg rename ../../d2/b e)
37 hg status
37 hg status -C
38 38 hg update -C
39 39
40 40 echo "# rename --after a file using a relative path"
41 41 (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
42 hg status
42 hg status -C
43 43 hg update -C
44 44
45 45 echo "# rename directory d1 as d3"
46 46 hg rename d1/ d3
47 hg status
47 hg status -C
48 48 hg update -C
49 49
50 50 echo "# rename --after directory d1 as d3"
51 51 mv d1 d3
52 52 hg rename --after d1 d3
53 hg status
53 hg status -C
54 54 hg update -C
55 55
56 56 echo "# move a directory using a relative path"
57 57 (cd d2; mkdir d3; hg rename ../d1/d11 d3)
58 hg status
58 hg status -C
59 59 hg update -C
60 60
61 61 echo "# move --after a directory using a relative path"
62 62 (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
63 hg status
63 hg status -C
64 64 hg update -C
65 65
66 66 echo "# move directory d1/d11 to an existing directory d2 (removes empty d1)"
67 67 hg rename d1/d11/ d2
68 hg status
68 hg status -C
69 69 hg update -C
70 70
71 71 echo "# move directories d1 and d2 to a new directory d3"
72 72 mkdir d3
73 73 hg rename d1 d2 d3
74 hg status
74 hg status -C
75 75 hg update -C
76 76
77 77 echo "# move --after directories d1 and d2 to a new directory d3"
78 78 mkdir d3
79 79 mv d1 d2 d3
80 80 hg rename --after d1 d2 d3
81 hg status
81 hg status -C
82 82 hg update -C
83 83
84 84 echo "# move everything under directory d1 to existing directory d2, do not"
85 85 echo "# overwrite existing files (d2/b)"
86 86 hg rename d1/* d2
87 hg status
87 hg status -C
88 88 diff d1/b d2/b
89 89 hg update -C
90 90
@@ -95,117 +95,116 b" hg rename 'glob:d1/**' dx"
95 95 echo "# move every file under d1 to d2/d21 (glob)"
96 96 mkdir d2/d21
97 97 hg rename 'glob:d1/**' d2/d21
98 hg status
98 hg status -C
99 99 hg update -C
100 100
101 101 echo "# move --after some files under d1 to d2/d21 (glob)"
102 102 mkdir d2/d21
103 103 mv d1/a d1/d11/a1 d2/d21
104 104 hg rename --after 'glob:d1/**' d2/d21
105 hg status
105 hg status -C
106 106 hg update -C
107 107
108 108 echo "# move every file under d1 starting with an 'a' to d2/d21 (regexp)"
109 109 mkdir d2/d21
110 110 hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
111 hg status
111 hg status -C
112 112 hg update -C
113 113
114 114 echo "# attempt to overwrite an existing file"
115 115 echo "ca" > d1/ca
116 116 hg rename d1/ba d1/ca
117 hg status
117 hg status -C
118 118 hg update -C
119 119
120 120 echo "# forced overwrite of an existing file"
121 121 echo "ca" > d1/ca
122 122 hg rename --force d1/ba d1/ca
123 hg status
123 hg status -C
124 124 hg update -C
125 125
126 126 echo "# replace a symlink with a file"
127 127 ln -s ba d1/ca
128 128 hg rename --force d1/ba d1/ca
129 hg status
129 hg status -C
130 130 hg update -C
131 131
132 132 echo "# do not copy more than one source file to the same destination file"
133 133 mkdir d3
134 134 hg rename d1/* d2/* d3
135 hg status
135 hg status -C
136 136 hg update -C
137 137
138 138 echo "# move a whole subtree with \"hg rename .\""
139 139 mkdir d3
140 140 (cd d1; hg rename . ../d3)
141 hg status
141 hg status -C
142 142 hg update -C
143 143
144 144 echo "# move a whole subtree with \"hg rename --after .\""
145 145 mkdir d3
146 146 mv d1/* d3
147 147 (cd d1; hg rename --after . ../d3)
148 hg status
148 hg status -C
149 149 hg update -C
150 150
151 151 echo "# move the parent tree with \"hg rename ..\""
152 152 (cd d1/d11; hg rename .. ../../d3)
153 hg status
153 hg status -C
154 154 hg update -C
155 155
156 156 echo "# skip removed files"
157 157 hg remove d1/b
158 158 hg rename d1 d3
159 hg status
159 hg status -C
160 160 hg update -C
161 161
162 162 echo "# transitive rename"
163 163 hg rename d1/b d1/bb
164 164 hg rename d1/bb d1/bc
165 hg status
165 hg status -C
166 166 hg update -C
167 167
168 168 echo "# transitive rename --after"
169 169 hg rename d1/b d1/bb
170 170 mv d1/bb d1/bc
171 171 hg rename --after d1/bb d1/bc
172 hg status
172 hg status -C
173 173 hg update -C
174 174
175 175 echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
176 176 hg rename d1/b d1/bb
177 177 echo "some stuff added to d1/bb" >> d1/bb
178 178 hg rename d1/bb d1/b
179 hg status
180 hg debugstate | grep copy
179 hg status -C
181 180 hg update -C
182 181
183 182 echo "# check illegal path components"
184 183
185 184 hg rename d1/d11/a1 .hg/foo
186 hg status
185 hg status -C
187 186 hg rename d1/d11/a1 ../foo
188 hg status
187 hg status -C
189 188
190 189 mv d1/d11/a1 .hg/foo
191 190 hg rename --after d1/d11/a1 .hg/foo
192 hg status
191 hg status -C
193 192 hg update -C
194 193 rm .hg/foo
195 194
196 195 hg rename d1/d11/a1 .hg
197 hg status
196 hg status -C
198 197 hg rename d1/d11/a1 ..
199 hg status
198 hg status -C
200 199
201 200 mv d1/d11/a1 .hg
202 201 hg rename --after d1/d11/a1 .hg
203 hg status
202 hg status -C
204 203 hg update -C
205 204 rm .hg/a1
206 205
207 206 (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
208 hg status
207 hg status -C
209 208 (cd d1/d11; hg rename ../../d2/b ../../../foo)
210 hg status
209 hg status -C
211 210
@@ -1,25 +1,31 b''
1 1 # rename a single file
2 2 A d2/c
3 d1/d11/a1
3 4 R d1/d11/a1
4 5 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
5 6 # rename --after a single file
6 7 A d2/c
8 d1/d11/a1
7 9 R d1/d11/a1
8 10 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
9 11 # move a single file to an existing directory
10 12 A d2/a1
13 d1/d11/a1
11 14 R d1/d11/a1
12 15 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 16 # move --after a single file to an existing directory
14 17 A d2/a1
18 d1/d11/a1
15 19 R d1/d11/a1
16 20 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
17 21 # rename a file using a relative path
18 22 A d1/d11/e
23 d2/b
19 24 R d2/b
20 25 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
21 26 # rename --after a file using a relative path
22 27 A d1/d11/e
28 d2/b
23 29 R d2/b
24 30 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 31 # rename directory d1 as d3
@@ -32,9 +38,13 b' removing d1/b'
32 38 removing d1/ba
33 39 removing d1/d11/a1
34 40 A d3/a
41 d1/a
35 42 A d3/b
43 d1/b
36 44 A d3/ba
45 d1/ba
37 46 A d3/d11/a1
47 d1/d11/a1
38 48 R d1/a
39 49 R d1/b
40 50 R d1/ba
@@ -50,9 +60,13 b' removing d1/b'
50 60 removing d1/ba
51 61 removing d1/d11/a1
52 62 A d3/a
63 d1/a
53 64 A d3/b
65 d1/b
54 66 A d3/ba
67 d1/ba
55 68 A d3/d11/a1
69 d1/d11/a1
56 70 R d1/a
57 71 R d1/b
58 72 R d1/ba
@@ -62,18 +76,21 b' 4 files updated, 0 files merged, 4 files'
62 76 copying ../d1/d11/a1 to d3/d11/a1
63 77 removing ../d1/d11/a1
64 78 A d2/d3/d11/a1
79 d1/d11/a1
65 80 R d1/d11/a1
66 81 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
67 82 # move --after a directory using a relative path
68 83 copying ../d1/d11/a1 to d3/d11/a1
69 84 removing ../d1/d11/a1
70 85 A d2/d3/d11/a1
86 d1/d11/a1
71 87 R d1/d11/a1
72 88 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
73 89 # move directory d1/d11 to an existing directory d2 (removes empty d1)
74 90 copying d1/d11/a1 to d2/d11/a1
75 91 removing d1/d11/a1
76 92 A d2/d11/a1
93 d1/d11/a1
77 94 R d1/d11/a1
78 95 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
79 96 # move directories d1 and d2 to a new directory d3
@@ -88,10 +105,15 b' removing d1/ba'
88 105 removing d1/d11/a1
89 106 removing d2/b
90 107 A d3/d1/a
108 d1/a
91 109 A d3/d1/b
110 d1/b
92 111 A d3/d1/ba
112 d1/ba
93 113 A d3/d1/d11/a1
114 d1/d11/a1
94 115 A d3/d2/b
116 d2/b
95 117 R d1/a
96 118 R d1/b
97 119 R d1/ba
@@ -110,10 +132,15 b' removing d1/ba'
110 132 removing d1/d11/a1
111 133 removing d2/b
112 134 A d3/d1/a
135 d1/a
113 136 A d3/d1/b
137 d1/b
114 138 A d3/d1/ba
139 d1/ba
115 140 A d3/d1/d11/a1
141 d1/d11/a1
116 142 A d3/d2/b
143 d2/b
117 144 R d1/a
118 145 R d1/b
119 146 R d1/ba
@@ -126,8 +153,11 b' d2/b: not overwriting - file exists'
126 153 copying d1/d11/a1 to d2/d11/a1
127 154 removing d1/d11/a1
128 155 A d2/a
156 d1/a
129 157 A d2/ba
158 d1/ba
130 159 A d2/d11/a1
160 d1/d11/a1
131 161 R d1/a
132 162 R d1/ba
133 163 R d1/d11/a1
@@ -149,9 +179,13 b' removing d1/b'
149 179 removing d1/ba
150 180 removing d1/d11/a1
151 181 A d2/d21/a
182 d1/a
152 183 A d2/d21/a1
184 d1/d11/a1
153 185 A d2/d21/b
186 d1/b
154 187 A d2/d21/ba
188 d1/ba
155 189 R d1/a
156 190 R d1/b
157 191 R d1/ba
@@ -163,7 +197,9 b' copying d1/d11/a1 to d2/d21/a1'
163 197 removing d1/a
164 198 removing d1/d11/a1
165 199 A d2/d21/a
200 d1/a
166 201 A d2/d21/a1
202 d1/d11/a1
167 203 R d1/a
168 204 R d1/d11/a1
169 205 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
@@ -173,7 +209,9 b' copying d1/d11/a1 to d2/d21/a1'
173 209 removing d1/a
174 210 removing d1/d11/a1
175 211 A d2/d21/a
212 d1/a
176 213 A d2/d21/a1
214 d1/d11/a1
177 215 R d1/a
178 216 R d1/d11/a1
179 217 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
@@ -183,10 +221,12 b' d1/ca: not overwriting - file exists'
183 221 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
184 222 # forced overwrite of an existing file
185 223 A d1/ca
224 d1/ba
186 225 R d1/ba
187 226 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
188 227 # replace a symlink with a file
189 228 A d1/ca
229 d1/ba
190 230 R d1/ba
191 231 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
192 232 # do not copy more than one source file to the same destination file
@@ -194,9 +234,13 b' copying d1/d11/a1 to d3/d11/a1'
194 234 d3/b: not overwriting - d2/b collides with d1/b
195 235 removing d1/d11/a1
196 236 A d3/a
237 d1/a
197 238 A d3/b
239 d1/b
198 240 A d3/ba
241 d1/ba
199 242 A d3/d11/a1
243 d1/d11/a1
200 244 R d1/a
201 245 R d1/b
202 246 R d1/ba
@@ -212,9 +256,13 b' removing b'
212 256 removing ba
213 257 removing d11/a1
214 258 A d3/d1/a
259 d1/a
215 260 A d3/d1/b
261 d1/b
216 262 A d3/d1/ba
263 d1/ba
217 264 A d3/d1/d11/a1
265 d1/d11/a1
218 266 R d1/a
219 267 R d1/b
220 268 R d1/ba
@@ -230,9 +278,13 b' removing b'
230 278 removing ba
231 279 removing d11/a1
232 280 A d3/a
281 d1/a
233 282 A d3/b
283 d1/b
234 284 A d3/ba
285 d1/ba
235 286 A d3/d11/a1
287 d1/d11/a1
236 288 R d1/a
237 289 R d1/b
238 290 R d1/ba
@@ -248,9 +300,13 b' removing ../b'
248 300 removing ../ba
249 301 removing a1
250 302 A d3/a
303 d1/a
251 304 A d3/b
305 d1/b
252 306 A d3/ba
307 d1/ba
253 308 A d3/d11/a1
309 d1/d11/a1
254 310 R d1/a
255 311 R d1/b
256 312 R d1/ba
@@ -264,8 +320,11 b' removing d1/a'
264 320 removing d1/ba
265 321 removing d1/d11/a1
266 322 A d3/a
323 d1/a
267 324 A d3/ba
325 d1/ba
268 326 A d3/d11/a1
327 d1/d11/a1
269 328 R d1/a
270 329 R d1/b
271 330 R d1/ba
@@ -273,10 +332,12 b' R d1/d11/a1'
273 332 4 files updated, 0 files merged, 3 files removed, 0 files unresolved
274 333 # transitive rename
275 334 A d1/bc
335 d1/b
276 336 R d1/b
277 337 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
278 338 # transitive rename --after
279 339 A d1/bc
340 d1/b
280 341 R d1/b
281 342 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
282 343 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
General Comments 0
You need to be logged in to leave comments. Login now