Mercurial > evolve
changeset 3385:823031b51d81
evolve: don't use graftstate for continuing `hg evolve`
Before this patch, if user runs `hg evolve`, we read the evolve state, write a
graftstate from that information and run graft command. This patch replaces that
logic with new logic which does not depends on the graft state.
The new logic is very filtered part of logic from graft command. We did not
require a lot of opts checking and filtering revs logic from the graft command
as our use case is fixed.
This is the start of series/work which will make `hg evolve` better and have
a good statefile for itself.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 06 Jan 2018 18:48:15 +0530 |
parents | 2b06f144b6e0 |
children | 2a51107e60cf |
files | hgext3rd/evolve/__init__.py tests/test-stabilize-conflict.t tests/test-stabilize-result.t |
diffstat | 3 files changed, 23 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Tue Jan 09 23:42:57 2018 +0530 +++ b/hgext3rd/evolve/__init__.py Sat Jan 06 18:48:15 2018 +0530 @@ -1610,19 +1610,26 @@ if state is None: raise error.Abort('no evolve to continue') orig = repo[state['current']] - # XXX This is a terrible terrible hack, please get rid of it. - lock = repo.wlock() - try: - repo.vfs.write('graftstate', orig.hex() + '\n') - try: - graftcmd = commands.table['graft'][0] - ret = graftcmd(ui, repo, old_obsolete=True, **{'continue': True}) - _evolvestatedelete(repo) - return ret - finally: - util.unlinkpath(repo.vfs.join('graftstate'), ignoremissing=True) - finally: - lock.release() + with repo.wlock(), repo.lock(): + ctx = orig + source = ctx.extra().get('source') + extra = {} + if source: + extra['source'] = source + extra['intermediate-source'] = ctx.hex() + else: + extra['source'] = ctx.hex() + user = ctx.user() + date = ctx.date() + message = ctx.description() + ui.status(_('evolving %d:%s "%s"\n') % (ctx.rev(), ctx, + message.split('\n', 1)[0])) + node = repo.commit(text=message, user=user, + date=date, extra=extra) + obsolete.createmarkers(repo, [(ctx, (repo[node],))]) + _evolvestatedelete(repo) + return + cmdutil.bailifchanged(repo) if revopt and allopt:
--- a/tests/test-stabilize-conflict.t Tue Jan 09 23:42:57 2018 +0530 +++ b/tests/test-stabilize-conflict.t Sat Jan 06 18:48:15 2018 +0530 @@ -168,7 +168,7 @@ $ hg resolve --all -m (no more unresolved files) $ hg evolve --continue - grafting 4:71c18f70c34f "babar count up to fifteen" + evolving 4:71c18f70c34f "babar count up to fifteen" $ hg resolve -l $ hg log -G @ changeset: 6:1836b91c6c1d
--- a/tests/test-stabilize-result.t Tue Jan 09 23:42:57 2018 +0530 +++ b/tests/test-stabilize-result.t Sat Jan 06 18:48:15 2018 +0530 @@ -93,13 +93,13 @@ +a +newer a $ hg evolve --continue - grafting 4:3655f0f50885 "newer a" + evolving 4:3655f0f50885 "newer a" abort: unresolved merge conflicts (see 'hg help resolve') [255] $ hg resolve -m a (no more unresolved files) $ hg evolve --continue - grafting 4:3655f0f50885 "newer a" + evolving 4:3655f0f50885 "newer a" Stabilize latecomer with different parent =========================================