Mercurial > hg
comparison mercurial/commands.py @ 18039:2c2564280900
graft: explicit current node tracking
This changes graft to explicitly track the progression of commits it
makes, and updates it's idea of the current node based on it's last
commit, rather than from the working copy parent. This should have no
effect on the value of current since we were reading the working copy
parent immediately after commiting to it.
The motivation for this change is that a subsequent patch will break
the current node and working copy relationship. Splitting this out
into a separate patch will make that one more readible.
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Tue, 04 Dec 2012 12:54:18 -0800 |
parents | f8aee8033ab2 |
children | 0c2f0048125d |
comparison
equal
deleted
inserted
replaced
18038:f8aee8033ab2 | 18039:2c2564280900 |
---|---|
2828 if not revs: | 2828 if not revs: |
2829 return -1 | 2829 return -1 |
2830 | 2830 |
2831 wlock = repo.wlock() | 2831 wlock = repo.wlock() |
2832 try: | 2832 try: |
2833 current = repo['.'] | |
2833 for pos, ctx in enumerate(repo.set("%ld", revs)): | 2834 for pos, ctx in enumerate(repo.set("%ld", revs)): |
2834 current = repo['.'] | |
2835 | 2835 |
2836 ui.status(_('grafting revision %s\n') % ctx.rev()) | 2836 ui.status(_('grafting revision %s\n') % ctx.rev()) |
2837 if opts.get('dry_run'): | 2837 if opts.get('dry_run'): |
2838 continue | 2838 continue |
2839 | 2839 |
2881 # commit | 2881 # commit |
2882 node = repo.commit(text=message, user=user, | 2882 node = repo.commit(text=message, user=user, |
2883 date=date, extra=extra, editor=editor) | 2883 date=date, extra=extra, editor=editor) |
2884 if node is None: | 2884 if node is None: |
2885 ui.status(_('graft for revision %s is empty\n') % ctx.rev()) | 2885 ui.status(_('graft for revision %s is empty\n') % ctx.rev()) |
2886 else: | |
2887 current = repo[node] | |
2886 finally: | 2888 finally: |
2887 wlock.release() | 2889 wlock.release() |
2888 | 2890 |
2889 # remove state when we complete successfully | 2891 # remove state when we complete successfully |
2890 if not opts.get('dry_run') and os.path.exists(repo.join('graftstate')): | 2892 if not opts.get('dry_run') and os.path.exists(repo.join('graftstate')): |