# HG changeset patch # User Patrick Mezard # Date 1340444766 -7200 # Node ID 8529b4b95f5d2a5d31ce9516e2bcf068fc6b667f # Parent d68ccae92d5278dd43203d69256cb09fad9abbfc evolve: tidy up a bit - long lines - extra blank lines - commands options descriptions diff -r d68ccae92d52 -r 8529b4b95f5d hgext/evolve.py --- a/hgext/evolve.py Sat Jun 23 11:14:09 2012 +0200 +++ b/hgext/evolve.py Sat Jun 23 11:46:06 2012 +0200 @@ -27,13 +27,12 @@ ### util function ############################# + def noderange(repo, revsets): """The same as revrange but return node""" return map(repo.changelog.node, scmutil.revrange(repo, revsets)) - - def warnunstable(orig, ui, repo, *args, **kwargs): """display warning is the command resulted in more instable changeset""" priorunstables = len(repo.revs('unstable()')) @@ -48,11 +47,6 @@ if newunstables > 0: ui.warn(_('%i new unstables changesets\n') % newunstables) - -### extension check -############################# - - ### changeset rewriting logic ############################# @@ -177,7 +171,8 @@ else: rebase.rebasenode(repo, orig.node(), dest.node(), {node.nullrev: node.nullrev}) - nodenew = rebase.concludenode(repo, orig.node(), dest.node(), node.nullid) + nodenew = rebase.concludenode(repo, orig.node(), dest.node(), + node.nullid) oldbookmarks = repo.nodebookmarks(nodesrc) if nodenew is not None: phases.retractboundary(repo, destphase, [nodenew]) @@ -198,7 +193,6 @@ repo.dirstate.invalidate() raise - def stabilizableunstable(repo, pctx): """Return a changectx for an unstable changeset which can be stabilized on top of pctx or one of its descendants. None if none @@ -224,11 +218,9 @@ command = cmdutil.command(cmdtable) @command('^stabilize|evolve', - [ - ('n', 'dry-run', False, 'Do nothing but printing what should be done'), - ('A', 'any', False, 'Stabilize unstable change on any topological branch'), - ], - '') + [('n', 'dry-run', False, 'do not perform actions, print what to be done'), + ('A', 'any', False, 'stabilize any unstable changeset'),], + _('[OPTIONS]...')) def stabilize(ui, repo, **opts): """rebase an unstable changeset to make it stable again @@ -296,10 +288,10 @@ shorttemplate = '[{rev}] {desc|firstline}\n' @command('^gdown', - [], - 'update to working directory parent and display summary lines') + [], + '') def cmdgdown(ui, repo): - """update to working directory parent an display summary lines""" + """update to parent an display summary lines""" wkctx = repo[None] wparents = wkctx.parents() if len(wparents) != 1: @@ -319,10 +311,10 @@ return 1 @command('^gup', - [], - 'update to working directory children and display summary lines') + [], + '') def cmdup(ui, repo): - """update to working directory children an display summary lines""" + """update to child an display summary lines""" wkctx = repo[None] wparents = wkctx.parents() if len(wparents) != 1: @@ -344,12 +336,9 @@ ui.warn(_('Multiple non-obsolete children, explicitly update to one\n')) return 1 - @command('^kill|obsolete', - [ - ('n', 'new', [], _("New changeset that justify this one to be killed")) - ], - '') + [('n', 'new', [], _("successor changeset"))], + _('[OPTION] REV...')) def kill(ui, repo, *revs, **opts): """mark a changeset as obsolete @@ -387,15 +376,11 @@ @command('^amend|refresh', [('A', 'addremove', None, _('mark new/missing files as added/removed before committing')), - ('n', 'note', '', - _('use text as commit message for this update')), - ('c', 'change', '', - _('specifies the changeset to amend'), _('REV')), - ('e', 'edit', False, - _('edit commit message.'), _('')), + ('n', 'note', '', _('use text as commit message for this update')), + ('c', 'change', '', _('specifies the changesets to amend'), _('REV')), + ('e', 'edit', False, _('invoke editor on commit messages')), ] + walkopts + commitopts + commitopts2, _('[OPTION]... [FILE]...')) - def amend(ui, repo, *pats, **opts): """combine a changeset with updates and replace it with a new one @@ -406,8 +391,9 @@ If you don't specify -m, the parent's message will be reused. - If you specify --change, amend additionally considers all changesets between - the indicated changeset and the working copy parent as updates to be subsumed. + If you specify --change, amend additionally considers all + changesets between the indicated changeset and the working copy + parent as updates to be subsumed. Behind the scenes, Mercurial first commits the update as a regular child of the current parent. Then it creates a new commit on the parent's parents @@ -426,7 +412,8 @@ wlock = repo.wlock() try: if old.phase() == phases.public: - raise util.Abort(_("can not rewrite immutable changeset %s") % old) + raise util.Abort(_("can not rewrite immutable changeset %s") + % old) oldphase = old.phase() # commit current changes as update # code copied from commands.commit to avoid noisy messages @@ -436,8 +423,8 @@ ciopts['message'] = opts.get('note') or ('amends %s' % old.hex()) e = cmdutil.commiteditor def commitfunc(ui, repo, message, match, opts): - return repo.commit(message, opts.get('user'), opts.get('date'), match, - editor=e) + return repo.commit(message, opts.get('user'), opts.get('date'), + match, editor=e) revcount = len(repo) tempid = cmdutil.commit(ui, repo, commitfunc, pats, ciopts) if len(repo) == revcount: @@ -458,8 +445,6 @@ raise error.Abort(_('no updates found')) updates = [repo[n] for n in updatenodes] - - # perform amend if opts.get('edit'): opts['force_editor'] = True @@ -482,9 +467,6 @@ finally: lock.release() - - - def commitwrapper(orig, ui, repo, *arg, **kwargs): lock = repo.lock() try: @@ -539,10 +521,13 @@ raise error.Abort(_('evolution extension require rebase extension.')) entry = extensions.wrapcommand(commands.table, 'commit', commitwrapper) - entry[1].append(('o', 'obsolete', [], _("this commit obsolet this revision"))) + entry[1].append(('o', 'obsolete', [], + _("make commit obsolete 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"))) + entry[1].append(('o', 'obsolete', [], + _("make graft obsoletes this revision"))) + entry[1].append(('O', 'old-obsolete', False, + _("make graft obsoletes its source"))) # warning about more obsolete for cmd in ['commit', 'push', 'pull', 'graft']: