Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 38451:3c07e0b1f6c6
graft: start storing new nodes formed in graftstate
This patch starts storing the new nodes formed during the ongoing graft
operation in the graftstate. We need the list of new nodes formed while
implmenting `graft --abort` which will strip out the new nodes.
Differential Revision: https://phab.mercurial-scm.org/D3751
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 15 Jun 2018 02:34:27 +0530 |
parents | 5d9b765dbe15 |
children | afb7e15392b9 |
comparison
equal
deleted
inserted
replaced
38450:b45c353ebbc7 | 38451:3c07e0b1f6c6 |
---|---|
2184 | 2184 |
2185 revs = list(revs) | 2185 revs = list(revs) |
2186 revs.extend(opts.get('rev')) | 2186 revs.extend(opts.get('rev')) |
2187 # a dict of data to be stored in state file | 2187 # a dict of data to be stored in state file |
2188 statedata = {} | 2188 statedata = {} |
2189 # list of new nodes created by ongoing graft | |
2190 statedata['newnodes'] = [] | |
2189 | 2191 |
2190 if not opts.get('user') and opts.get('currentuser'): | 2192 if not opts.get('user') and opts.get('currentuser'): |
2191 opts['user'] = ui.username() | 2193 opts['user'] = ui.username() |
2192 if not opts.get('date') and opts.get('currentdate'): | 2194 if not opts.get('date') and opts.get('currentdate'): |
2193 opts['date'] = "%d %d" % dateutil.makedate() | 2195 opts['date'] = "%d %d" % dateutil.makedate() |
2360 date=date, extra=extra, editor=editor) | 2362 date=date, extra=extra, editor=editor) |
2361 if node is None: | 2363 if node is None: |
2362 ui.warn( | 2364 ui.warn( |
2363 _('note: graft of %d:%s created no changes to commit\n') % | 2365 _('note: graft of %d:%s created no changes to commit\n') % |
2364 (ctx.rev(), ctx)) | 2366 (ctx.rev(), ctx)) |
2367 # checking that newnodes exist because old state files won't have it | |
2368 elif statedata.get('newnodes') is not None: | |
2369 statedata['newnodes'].append(node) | |
2365 | 2370 |
2366 # remove state when we complete successfully | 2371 # remove state when we complete successfully |
2367 if not opts.get('dry_run'): | 2372 if not opts.get('dry_run'): |
2368 graftstate.delete() | 2373 graftstate.delete() |
2369 | 2374 |