##// END OF EJS Templates
fix: use rewriteutil.precheck() instead of reimplementing it...
Martin von Zweigbergk -
r44388:699d6be3 default
parent child Browse files
Show More
@@ -144,9 +144,9 b' from mercurial import ('
144 144 match as matchmod,
145 145 mdiff,
146 146 merge,
147 obsolete,
148 147 pycompat,
149 148 registrar,
149 rewriteutil,
150 150 scmutil,
151 151 util,
152 152 worker,
@@ -403,7 +403,7 b' def getrevstofix(ui, repo, opts):'
403 403 checkfixablectx(ui, repo, repo[rev])
404 404 if revs:
405 405 cmdutil.checkunfinished(repo)
406 checknodescendants(repo, revs)
406 rewriteutil.precheck(repo, revs, b'fix')
407 407 if opts.get(b'working_dir'):
408 408 revs.add(wdirrev)
409 409 if list(merge.mergestate.read(repo).unresolved()):
@@ -415,22 +415,8 b' def getrevstofix(ui, repo, opts):'
415 415 return revs
416 416
417 417
418 def checknodescendants(repo, revs):
419 if not obsolete.isenabled(repo, obsolete.allowunstableopt) and repo.revs(
420 b'(%ld::) - (%ld)', revs, revs
421 ):
422 raise error.Abort(
423 _(b'can only fix a changeset together with all its descendants')
424 )
425
426
427 418 def checkfixablectx(ui, repo, ctx):
428 419 """Aborts if the revision shouldn't be replaced with a fixed one."""
429 if not ctx.mutable():
430 raise error.Abort(
431 b'can\'t fix immutable changeset %s'
432 % (scmutil.formatchangeid(ctx),)
433 )
434 420 if ctx.obsolete():
435 421 # It would be better to actually check if the revision has a successor.
436 422 allowdivergence = ui.configbool(
@@ -264,10 +264,12 b' nothing happens, even to the working dir'
264 264 $ hg commit -Aqm "hello"
265 265 $ hg phase -r 0 --public
266 266 $ hg fix -r 0
267 abort: can't fix immutable changeset 0:6470986d2e7b
267 abort: cannot fix public changesets
268 (see 'hg help phases' for details)
268 269 [255]
269 270 $ hg fix -r 0 --working-dir
270 abort: can't fix immutable changeset 0:6470986d2e7b
271 abort: cannot fix public changesets
272 (see 'hg help phases' for details)
271 273 [255]
272 274 $ hg cat -r tip hello.whole
273 275 hello
@@ -1171,7 +1173,7 b' an orphan. We must respect experimental.'
1171 1173 $ printf "two\n" > foo.whole
1172 1174 $ hg commit -m "second"
1173 1175 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1174 abort: can only fix a changeset together with all its descendants
1176 abort: cannot fix changeset with children
1175 1177 [255]
1176 1178 $ hg fix -r '.^'
1177 1179 1 new orphan changesets
General Comments 0
You need to be logged in to leave comments. Login now