##// END OF EJS Templates
unamend: drop unused vars, query after taking lock, use ctx.hex() for extras...
Pulkit Goyal -
r35201:9e339c97 default
parent child Browse files
Show More
@@ -212,11 +212,11 b' def unamend(ui, repo, **opts):'
212 212 """
213 213
214 214 unfi = repo.unfiltered()
215 with repo.wlock(), repo.lock(), repo.transaction('unamend'):
215 216
216 # identify the commit from which to unamend
217 curctx = repo['.']
217 # identify the commit from which to unamend
218 curctx = repo['.']
218 219
219 with repo.wlock(), repo.lock(), repo.transaction('unamend'):
220 220 if not curctx.mutable():
221 221 raise error.Abort(_('cannot unamend public changesets'))
222 222
@@ -235,7 +235,7 b' def unamend(ui, repo, **opts):'
235 235 # add an extra so that we get a new hash
236 236 # note: allowing unamend to undo an unamend is an intentional feature
237 237 extras = predctx.extra()
238 extras['unamend_source'] = curctx.node()
238 extras['unamend_source'] = curctx.hex()
239 239
240 240 def filectxfn(repo, ctx_, path):
241 241 try:
@@ -259,14 +259,7 b' def unamend(ui, repo, **opts):'
259 259 newprednode = repo.commitctx(newctx)
260 260
261 261 newpredctx = repo[newprednode]
262
263 changedfiles = []
264 wctx = repo[None]
265 wm = wctx.manifest()
266 cm = newpredctx.manifest()
267 262 dirstate = repo.dirstate
268 diff = cm.diff(wm)
269 changedfiles.extend(diff.iterkeys())
270 263
271 264 with dirstate.parentchange():
272 265 dirstate.setparents(newprednode, node.nullid)
@@ -83,7 +83,7 b' Unamend on clean wdir and tip'
83 83
84 84 $ hg unamend
85 85 $ hg glog --hidden
86 @ 9:8da14a1fd653 Added h
86 @ 9:46d02d47eec6 Added h
87 87 |
88 88 | x 8:c9fa1a715c1b Added h
89 89 |/
@@ -104,7 +104,7 b' Unamend on clean wdir and tip'
104 104 o 0:18d04c59bb5d Added a
105 105
106 106 $ hg diff
107 diff -r 8da14a1fd653 h
107 diff -r 46d02d47eec6 h
108 108 --- a/h Thu Jan 01 00:00:00 1970 +0000
109 109 +++ b/h Thu Jan 01 00:00:00 1970 +0000
110 110 @@ -1,1 +1,2 @@
@@ -116,11 +116,11 b' Unamend on clean wdir and tip'
116 116 # User test
117 117 # Date 0 0
118 118 # Thu Jan 01 00:00:00 1970 +0000
119 # Node ID 8da14a1fd653c3f07fdad5760511c9e12652a306
119 # Node ID 46d02d47eec6ca096b8dcab3f8f5579c40c3dd9a
120 120 # Parent 87d6d66763085b629e6d7ed56778c79827273022
121 121 Added h
122 122
123 diff -r 87d6d6676308 -r 8da14a1fd653 h
123 diff -r 87d6d6676308 -r 46d02d47eec6 h
124 124 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
125 125 +++ b/h Thu Jan 01 00:00:00 1970 +0000
126 126 @@ -0,0 +1,1 @@
@@ -131,7 +131,7 b' Unamend on clean wdir and tip'
131 131
132 132 $ hg log -r . -T '{extras % "{extra}\n"}' --config alias.log=log
133 133 branch=default
134 unamend_source=\xc9\xfa\x1aq\\\x1bva\xc0\xfa\xfb6*\x9f0\xbdu\x87\x8d}
134 unamend_source=c9fa1a715c1b7661c0fafb362a9f30bd75878d7d
135 135
136 136 Using unamend to undo an unamed (intentional)
137 137
@@ -141,11 +141,11 b' Using unamend to undo an unamed (intenti'
141 141 # User test
142 142 # Date 0 0
143 143 # Thu Jan 01 00:00:00 1970 +0000
144 # Node ID 1c09887216571a9755fc9d2e7f0e41c2b49e341b
144 # Node ID 850ddfc1bc662997ec6094ada958f01f0cc8070a
145 145 # Parent 87d6d66763085b629e6d7ed56778c79827273022
146 146 Added h
147 147
148 diff -r 87d6d6676308 -r 1c0988721657 h
148 diff -r 87d6d6676308 -r 850ddfc1bc66 h
149 149 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
150 150 +++ b/h Thu Jan 01 00:00:00 1970 +0000
151 151 @@ -0,0 +1,2 @@
@@ -170,14 +170,14 b' Unamend on a dirty working directory'
170 170 M b
171 171
172 172 $ hg diff
173 diff -r 956548224719 a
173 diff -r ec338db45d51 a
174 174 --- a/a Thu Jan 01 00:00:00 1970 +0000
175 175 +++ b/a Thu Jan 01 00:00:00 1970 +0000
176 176 @@ -1,1 +1,3 @@
177 177 foo
178 178 +bar
179 179 +foobar
180 diff -r 956548224719 b
180 diff -r ec338db45d51 b
181 181 --- a/b Thu Jan 01 00:00:00 1970 +0000
182 182 +++ b/b Thu Jan 01 00:00:00 1970 +0000
183 183 @@ -1,1 +1,2 @@
@@ -223,7 +223,7 b' Unamending an added file with dirty wdir'
223 223 $ hg status
224 224 A bar
225 225 $ hg diff
226 diff -r ff917aa01c86 bar
226 diff -r 7f79409af972 bar
227 227 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
228 228 +++ b/bar Thu Jan 01 00:00:00 1970 +0000
229 229 @@ -0,0 +1,2 @@
@@ -236,9 +236,9 b' Unamending an added file with dirty wdir'
236 236 Unamending in middle of a stack
237 237
238 238 $ hg glog
239 @ 19:ff917aa01c86 Added things to a and b
239 @ 19:7f79409af972 Added things to a and b
240 240 |
241 o 12:956548224719 Added h
241 o 12:ec338db45d51 Added h
242 242 |
243 243 o 6:87d6d6676308 Added g
244 244 |
@@ -261,9 +261,9 b' Unamending in middle of a stack'
261 261 $ hg rebase -s 6 -d . -q
262 262
263 263 $ hg glog
264 o 23:2b41b42e192a Added things to a and b
264 o 23:03ddd6fc5af1 Added things to a and b
265 265 |
266 o 22:1860df151f01 Added h
266 o 22:3e7b64ee157b Added h
267 267 |
268 268 o 21:49635b68477e Added g
269 269 |
@@ -306,8 +306,8 b' Testing whether unamend retains copies o'
306 306 # User test
307 307 # Date 0 0
308 308 # Thu Jan 01 00:00:00 1970 +0000
309 # Node ID b087c66cada118d6c5487d3d7cb29cac239bd98a
310 # Parent 2b41b42e192adc425b106643c3fc89170d6b8add
309 # Node ID cfef290346fbee5126313d7e1aab51d877679b09
310 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
311 311 Moved a to foo
312 312
313 313 diff --git a/a b/foo
@@ -326,8 +326,8 b' Testing whether unamend retains copies o'
326 326 # User test
327 327 # Date 0 0
328 328 # Thu Jan 01 00:00:00 1970 +0000
329 # Node ID 9fa06fb09a83a86ec7368d15004dbc52ac1a5d2e
330 # Parent 2b41b42e192adc425b106643c3fc89170d6b8add
329 # Node ID eca050985275bb271ce3092b54e56ea5c85d29a3
330 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
331 331 Moved a to foo
332 332
333 333 diff --git a/a b/foo
@@ -347,8 +347,8 b' Retained copies in new prdecessor commit'
347 347 # User test
348 348 # Date 0 0
349 349 # Thu Jan 01 00:00:00 1970 +0000
350 # Node ID 4cf9987c9b941f615930e7c46307b4dbf35697cf
351 # Parent 2b41b42e192adc425b106643c3fc89170d6b8add
350 # Node ID 552e3af4f01f620f88ca27be1f898316235b736a
351 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
352 352 Moved a to foo
353 353
354 354 diff --git a/a b/foo
General Comments 0
You need to be logged in to leave comments. Login now