Mercurial > evolve
comparison hgext/evolve.py @ 263:de62daaf2054
amend: drop --branches, pick it from working directory
The amended changeset branch was picked either from --branch or from the
first parent, but the actual working directory branch was ignored. The
behaviour is changed so the amended revision branch is picked from the
intermediate revision, which branch comes from the usual working
directory rules. --branch is thus replaced by "hg branch".
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Tue, 12 Jun 2012 11:14:02 +0200 |
parents | fd3db1e6b7a3 |
children | 1c21865bf8ba |
comparison
equal
deleted
inserted
replaced
262:4675d9c6c66b | 263:de62daaf2054 |
---|---|
110 else: | 110 else: |
111 message = old.description() | 111 message = old.description() |
112 | 112 |
113 user = commitopts.get('user') or old.user() | 113 user = commitopts.get('user') or old.user() |
114 date = commitopts.get('date') or None # old.date() | 114 date = commitopts.get('date') or None # old.date() |
115 extra = dict(commitopts.get('extra', {})) | |
116 extra['branch'] = head.branch() | |
115 | 117 |
116 new = context.memctx(repo, | 118 new = context.memctx(repo, |
117 parents=newbases, | 119 parents=newbases, |
118 text=message, | 120 text=message, |
119 files=files, | 121 files=files, |
120 filectxfn=filectxfn, | 122 filectxfn=filectxfn, |
121 user=user, | 123 user=user, |
122 date=date, | 124 date=date, |
123 extra=commitopts.get('extra') or None) | 125 extra=extra) |
124 | 126 |
125 if commitopts.get('edit'): | 127 if commitopts.get('edit'): |
126 new._text = cmdutil.commitforceeditor(repo, new, []) | 128 new._text = cmdutil.commitforceeditor(repo, new, []) |
127 newid = repo.commitctx(new) | 129 newid = repo.commitctx(new) |
128 new = repo[newid] | 130 new = repo[newid] |
350 _('mark new/missing files as added/removed before committing')), | 352 _('mark new/missing files as added/removed before committing')), |
351 ('n', 'note', '', | 353 ('n', 'note', '', |
352 _('use text as commit message for this update')), | 354 _('use text as commit message for this update')), |
353 ('c', 'change', '', | 355 ('c', 'change', '', |
354 _('specifies the changeset to amend'), _('REV')), | 356 _('specifies the changeset to amend'), _('REV')), |
355 ('b', 'branch', '', | |
356 _('specifies a branch for the new.'), _('REV')), | |
357 ('e', 'edit', False, | 357 ('e', 'edit', False, |
358 _('edit commit message.'), _('')), | 358 _('edit commit message.'), _('')), |
359 ] + walkopts + commitopts + commitopts2, | 359 ] + walkopts + commitopts + commitopts2, |
360 _('[OPTION]... [FILE]...')) | 360 _('[OPTION]... [FILE]...')) |
361 | 361 |
387 # determine updates to subsume | 387 # determine updates to subsume |
388 change = opts.get('change') | 388 change = opts.get('change') |
389 if change == '.': | 389 if change == '.': |
390 change = 'p1(p1())' | 390 change = 'p1(p1())' |
391 old = scmutil.revsingle(repo, change) | 391 old = scmutil.revsingle(repo, change) |
392 branch = opts.get('branch') | |
393 if branch: | |
394 opts.setdefault('extra', {})['branch'] = branch | |
395 else: | |
396 if old.branch() != 'default': | |
397 opts.setdefault('extra', {})['branch'] = old.branch() | |
398 | 392 |
399 lock = repo.lock() | 393 lock = repo.lock() |
400 try: | 394 try: |
401 wlock = repo.wlock() | 395 wlock = repo.wlock() |
402 try: | 396 try: |
419 cl = repo.changelog | 413 cl = repo.changelog |
420 head = repo['.'] | 414 head = repo['.'] |
421 updatenodes = set(cl.nodesbetween(roots=[old.node()], | 415 updatenodes = set(cl.nodesbetween(roots=[old.node()], |
422 heads=[head.node()])[0]) | 416 heads=[head.node()])[0]) |
423 updatenodes.remove(old.node()) | 417 updatenodes.remove(old.node()) |
424 okoptions = ['message', 'logfile', 'edit', 'user', 'branch'] | 418 okoptions = ['message', 'logfile', 'edit', 'user'] |
425 if not updatenodes: | 419 if not updatenodes: |
426 for o in okoptions: | 420 for o in okoptions: |
427 if opts.get(o): | 421 if opts.get(o): |
428 break | 422 break |
429 else: | 423 else: |