Mercurial > evolve
changeset 117:438fe133b068
Add a -o and -O option to graft.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 28 Dec 2011 13:10:24 +0100 |
parents | 64ca29eef349 |
children | 06fe05256a79 |
files | doc/from-mq.rst hgext/evolution.py |
diffstat | 2 files changed, 152 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/from-mq.rst Wed Dec 28 13:10:24 2011 +0100 @@ -0,0 +1,137 @@ +Moving from mq to hg-evolution +=============================== + + +quick reference: + +mq command equivalent + +hg qseries hg log +hg qnew hg commit +hg qrefresh hg amend +hg qpop hg update +hg qpush hg graft or rebase +hg qrm hg kill +hg qfold hg collapse +hg qdiff hg diff + +hg qfinish -- +hg qimport -- + + +hg qseries +----------- + +All your work in progress are now real changeset all the time. + +You can then use standard log to display them. You can use phase revset to +display unfinished business only and template to have the same kind of compact +output qseries have. + +This will result in something like that + + $ hg log -r 'not public()' --template='{rev}:{node|short} {description|firstline}\n' + + [alias] + wip = log -r 'not public()' --template='{rev}:{node|short} {description|firstline}\n' + +hg qnew +-------- + +With evolution you handle standard changeset without additional overlay. + +Standard changeset are created using hg commit as usual. + + $ hg commit + +If you want to keep the "wip are not pushed" behavior, you are looking for +setting your changeset in the secret phase. This can be achieved with the following sequence: + + $ hg phase --secret + $ hg commit + +Note that you only need it for the first commit you want to be secret. Later +commit will inherit their parents phase. + +If you always want your new commit to be in the secret phase, your should +consider updating your configuration: + + [phases] + new-commit=secret + +hg qref +-------- + +A new command from evolution will allow you to rewrite the changeset you are +current on. just invoc: + + $ hg amend + + +This command takes the same option than commit plus useful switch '-e' (--edit) + +Amend have also a -c switch which allow you to make and explicit amending +commit before rewriting a changeset. + + $ hg record -m 'feature A' + # oups, I forget some stuff + $ hg record babar.py + $ hg amend -c .^ # .^ refer to "working directoy parent, here 'feature A' + +note: refresh is an alias for amend + + +hg qpop +--------- + +If you need to go back to a previous state just: + + $ hg update + +hg qpush +-------- + +When you rewrite changeset, descendant of rewritten changeset are marked as +"out of sync". You new to rewrite them on top of the new version of their +ancestor. + +The evolution extension add a command to rewrite the next changeset: + + $ hg evolve + +You can also decide to do it manually using + + $ hg graft -O <old-version> + +or + + $ hg rebase -r <revset for old version> -d . + +note: using graft allow you to pick the changeset you want next as the --move +option of qpush do. + + +hg qrm +------- + +evolution introduce a new command to mark a changeset as "not wanted anymore". + + $ hg kill <revset> + +hg qfold +--------- + + + $ hg collapse # XXX not implemented + + $ hg rebase --collapse # XXX not tested + + +hg qdiff +--------- + + + + $ hg diff -r .^ + +
--- a/hgext/evolution.py Wed Dec 28 12:38:01 2011 +0100 +++ b/hgext/evolution.py Wed Dec 28 13:10:24 2011 +0100 @@ -225,6 +225,8 @@ _('specifies the changeset to amend'), _('REV')), ('b', 'branch', '', _('specifies a branch for the new.'), _('REV')), + ('e', 'edit', False, + _('edit commit message.'), _('')), ] + walkopts + commitopts + commitopts2, _('[OPTION]... [FILE]...')) @@ -274,7 +276,7 @@ ciopts.pop('logfile', None) ciopts['message'] = opts.get('note') or ('amends %s' % old.hex()) e = cmdutil.commiteditor - if ciopts.get('force_editor'): + if ciopts.get('edit'): e = cmdutil.commitforceeditor def commitfunc(ui, repo, message, match, opts): return repo.commit(message, opts.get('user'), opts.get('date'), match, @@ -313,7 +315,19 @@ repo.addobsolete(new.node(), old.node()) return result +def graftwrapper(orig, ui, repo, *revs, **kwargs): + if kwargs.get('old_obsolete'): + obsoleted = kwargs.setdefault('obsolete', []) + if kwargs['continue']: + obsoleted.extend(repo.opener.read('graftstate').splitlines()) + else: + obsoleted.extend(revs) + return commitwrapper(orig, ui, repo,*revs, **kwargs) + def extsetup(ui): entry = extensions.wrapcommand(commands.table, 'commit', commitwrapper) entry[1].append(('o', 'obsolete', [], _("this commit obsolet this revision"))) + entry = extensions.wrapcommand(commands.table, 'graft', graftwrapper) + entry[1].append(('o', 'obsolete', [], _("this graft obsolet this revision"))) + entry[1].append(('O', 'old-obsolete', False, _("graft result obsolete graft source")))