##// END OF EJS Templates
revert: update state of files in the "checkout" list...
Alexis S. L. Carvalho -
r6299:653ddd1d default
parent child Browse files
Show More
@@ -2380,8 +2380,19 b' def revert(ui, repo, *pats, **opts):'
2380 pass
2380 pass
2381 repo.dirstate.remove(f)
2381 repo.dirstate.remove(f)
2382
2382
2383 normal = None
2384 if node == parent:
2385 # We're reverting to our parent. If possible, we'd like status
2386 # to report the file as clean. We have to use normallookup for
2387 # merges to avoid losing information about merged/dirty files.
2388 if p2 != nullid:
2389 normal = repo.dirstate.normallookup
2390 else:
2391 normal = repo.dirstate.normal
2383 for f in revert[0]:
2392 for f in revert[0]:
2384 checkout(f)
2393 checkout(f)
2394 if normal:
2395 normal(f)
2385
2396
2386 for f in add[0]:
2397 for f in add[0]:
2387 checkout(f)
2398 checkout(f)
@@ -34,3 +34,10 b' cp B bar'
34 hg add -v foo1 bar
34 hg add -v foo1 bar
35 hg debugstate --nodates
35 hg debugstate --nodates
36 hg st -qC
36 hg st -qC
37
38 echo '% reverting foo1 and bar'
39 hg revert -vr . foo1 bar
40 hg debugstate --nodates
41 hg st -qC
42 hg diff
43
@@ -22,3 +22,15 b' copy: foo -> foo1'
22 M bar
22 M bar
23 M foo1
23 M foo1
24 foo
24 foo
25 % reverting foo1 and bar
26 warning: working directory has two parents, tag '.' uses the first
27 saving current version of bar as bar.orig
28 reverting bar
29 saving current version of foo1 as foo1.orig
30 reverting foo1
31 n 0 -2 bar
32 m 644 14 foo1
33 copy: foo -> foo1
34 M bar
35 M foo1
36 foo
@@ -99,3 +99,17 b' hg add f5.sh'
99 hg ci -m 7 -d'0 0'
99 hg ci -m 7 -d'0 0'
100 python print.py < f5.sh
100 python print.py < f5.sh
101 hg cat f5.sh | python print.py
101 hg cat f5.sh | python print.py
102
103 echo '% just linefeed' > linefeed
104 hg ci -qAm 8 linefeed
105 python print.py < linefeed
106 hg cat linefeed | python print.py
107 hg st -q
108 hg revert -a linefeed
109 python print.py < linefeed
110 hg st -q
111 echo modified >> linefeed
112 hg st -q
113 hg revert -a
114 hg st -q
115 python print.py < linefeed
@@ -177,3 +177,10 b' rem empty<CR><LF>'
177
177
178 # empty<CR><LF>
178 # empty<CR><LF>
179 # empty<LF>
179 # empty<LF>
180 % just linefeed<LF>
181 % just linefeed<LF>
182 no changes needed to linefeed
183 % just linefeed<LF>
184 M linefeed
185 reverting linefeed
186 % just linefeed<CR><LF>
General Comments 0
You need to be logged in to leave comments. Login now