##// 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 match as matchmod,
144 match as matchmod,
145 mdiff,
145 mdiff,
146 merge,
146 merge,
147 obsolete,
148 pycompat,
147 pycompat,
149 registrar,
148 registrar,
149 rewriteutil,
150 scmutil,
150 scmutil,
151 util,
151 util,
152 worker,
152 worker,
@@ -403,7 +403,7 b' def getrevstofix(ui, repo, opts):'
403 checkfixablectx(ui, repo, repo[rev])
403 checkfixablectx(ui, repo, repo[rev])
404 if revs:
404 if revs:
405 cmdutil.checkunfinished(repo)
405 cmdutil.checkunfinished(repo)
406 checknodescendants(repo, revs)
406 rewriteutil.precheck(repo, revs, b'fix')
407 if opts.get(b'working_dir'):
407 if opts.get(b'working_dir'):
408 revs.add(wdirrev)
408 revs.add(wdirrev)
409 if list(merge.mergestate.read(repo).unresolved()):
409 if list(merge.mergestate.read(repo).unresolved()):
@@ -415,22 +415,8 b' def getrevstofix(ui, repo, opts):'
415 return revs
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 def checkfixablectx(ui, repo, ctx):
418 def checkfixablectx(ui, repo, ctx):
428 """Aborts if the revision shouldn't be replaced with a fixed one."""
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 if ctx.obsolete():
420 if ctx.obsolete():
435 # It would be better to actually check if the revision has a successor.
421 # It would be better to actually check if the revision has a successor.
436 allowdivergence = ui.configbool(
422 allowdivergence = ui.configbool(
@@ -264,10 +264,12 b' nothing happens, even to the working dir'
264 $ hg commit -Aqm "hello"
264 $ hg commit -Aqm "hello"
265 $ hg phase -r 0 --public
265 $ hg phase -r 0 --public
266 $ hg fix -r 0
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 [255]
269 [255]
269 $ hg fix -r 0 --working-dir
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 [255]
273 [255]
272 $ hg cat -r tip hello.whole
274 $ hg cat -r tip hello.whole
273 hello
275 hello
@@ -1171,7 +1173,7 b' an orphan. We must respect experimental.'
1171 $ printf "two\n" > foo.whole
1173 $ printf "two\n" > foo.whole
1172 $ hg commit -m "second"
1174 $ hg commit -m "second"
1173 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
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 [255]
1177 [255]
1176 $ hg fix -r '.^'
1178 $ hg fix -r '.^'
1177 1 new orphan changesets
1179 1 new orphan changesets
General Comments 0
You need to be logged in to leave comments. Login now