comparison mercurial/commands.py @ 44725:16c361152133

graft: exit 1 on conflicts, like merge It's more consistent, and makes it nicer to script around hg if you don't have to ignore exit code 255, which is the error code for basically everything in hg. Differential Revision: https://phab.mercurial-scm.org/D8423
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Tue, 14 Apr 2020 19:09:56 -0400
parents 1b8fd4af3318
children e5043679bfcc a9ff0742c8ea
comparison
equal deleted inserted replaced
44724:5c2a4f37eace 44725:16c361152133
2949 hg up -cr default 2949 hg up -cr default
2950 hg graft -r featureX --base "ancestor('featureX', 'default')" 2950 hg graft -r featureX --base "ancestor('featureX', 'default')"
2951 2951
2952 See :hg:`help revisions` for more about specifying revisions. 2952 See :hg:`help revisions` for more about specifying revisions.
2953 2953
2954 Returns 0 on successful completion. 2954 Returns 0 on successful completion, 1 if there are unresolved files.
2955 ''' 2955 '''
2956 with repo.wlock(): 2956 with repo.wlock():
2957 return _dograft(ui, repo, *revs, **opts) 2957 return _dograft(ui, repo, *revs, **opts)
2958 2958
2959 2959
3210 # write out state for --continue 3210 # write out state for --continue
3211 nodes = [repo[rev].hex() for rev in revs[pos:]] 3211 nodes = [repo[rev].hex() for rev in revs[pos:]]
3212 statedata[b'nodes'] = nodes 3212 statedata[b'nodes'] = nodes
3213 stateversion = 1 3213 stateversion = 1
3214 graftstate.save(stateversion, statedata) 3214 graftstate.save(stateversion, statedata)
3215 hint = _(b"use 'hg resolve' and 'hg graft --continue'") 3215 ui.error(_(b"abort: unresolved conflicts, can't continue\n"))
3216 raise error.Abort( 3216 ui.error(_(b"(use 'hg resolve' and 'hg graft --continue')\n"))
3217 _(b"unresolved conflicts, can't continue"), hint=hint 3217 return 1
3218 )
3219 else: 3218 else:
3220 cont = False 3219 cont = False
3221 3220
3222 # commit if --no-commit is false 3221 # commit if --no-commit is false
3223 if not opts.get(b'no_commit'): 3222 if not opts.get(b'no_commit'):