# HG changeset patch # User Pierre-Yves David # Date 1495123487 -7200 # Node ID 89a5dabbb43da897f550d4433bbd13c8b2373edd # Parent fcf54ec1eaf73b0f89532dfe69e78ff4e0cc913b obshistory: move the command into the obshistory module The root module is far too large already. diff -r fcf54ec1eaf7 -r 89a5dabbb43d hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Thu May 18 17:40:07 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Thu May 18 18:04:47 2017 +0200 @@ -190,6 +190,7 @@ eh.merge(checkheads.eh) eh.merge(safeguard.eh) eh.merge(obscache.eh) +eh.merge(obshistory.eh) uisetup = eh.final_uisetup extsetup = eh.final_extsetup reposetup = eh.final_reposetup @@ -3261,48 +3262,3 @@ f.write(orig.topic()) return merge.graft(repo, orig, pctx, ['local', 'graft'], True) - -@eh.command( - '^debugobshistory', - [('G', 'graph', True, _("show the revision DAG")), - ('r', 'rev', [], _('show the specified revision or revset'), _('REV')) - ] + commands.formatteropts, - _('hg debugobshistory [OPTION]... [REV]')) -def cmdobshistory(ui, repo, *revs, **opts): - """show the obsolescence history of the specified revisions. - - By default this command prints the selected revisions and all its - precursors. For precursors pointing on existing revisions in the repository, - it will display revisions node id, revision number and the first line of the - description. For precursors pointing on non existing revisions in the - repository (that can happen when exchanging obsolescence-markers), display - only the node id. - - In both case, for each node, its obsolescence marker will be displayed with - the obsolescence operation (rewritten or pruned) in addition of the user and - date of the operation. - - The output is a graph by default but can deactivated with the option '--no- - graph'. - - 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete, - and '+' represents a fork where the changeset from the lines below is a - parent of the 'o' merge on the same line. - - Paths in the DAG are represented with '|', '/' and so forth. - - Returns 0 on success. - """ - revs = list(revs) + opts['rev'] - if not revs: - revs = ['.'] - revs = scmutil.revrange(repo, revs) - - if opts['graph']: - return obshistory._debugobshistorygraph(ui, repo, revs, opts) - - fm = ui.formatter('debugobshistory', opts) - revs.reverse() - obshistory._debugobshistorysingle(fm, repo, revs) - - fm.end() diff -r fcf54ec1eaf7 -r 89a5dabbb43d hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Thu May 18 17:40:07 2017 +0200 +++ b/hgext3rd/evolve/obshistory.py Thu May 18 18:04:47 2017 +0200 @@ -8,12 +8,67 @@ # GNU General Public License version 2 or any later version. from mercurial import ( - node as nodemod, cmdutil, + commands, + error, graphmod, - error + node as nodemod, + scmutil, +) + +from mercurial.i18n import _ + +from . import ( + exthelper, ) +eh = exthelper.exthelper() + +@eh.command( + '^debugobshistory', + [('G', 'graph', True, _("show the revision DAG")), + ('r', 'rev', [], _('show the specified revision or revset'), _('REV')) + ] + commands.formatteropts, + _('hg debugobshistory [OPTION]... [REV]')) +def cmdobshistory(ui, repo, *revs, **opts): + """show the obsolescence history of the specified revisions. + + By default this command prints the selected revisions and all its + precursors. For precursors pointing on existing revisions in the repository, + it will display revisions node id, revision number and the first line of the + description. For precursors pointing on non existing revisions in the + repository (that can happen when exchanging obsolescence-markers), display + only the node id. + + In both case, for each node, its obsolescence marker will be displayed with + the obsolescence operation (rewritten or pruned) in addition of the user and + date of the operation. + + The output is a graph by default but can deactivated with the option '--no- + graph'. + + 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete, + and '+' represents a fork where the changeset from the lines below is a + parent of the 'o' merge on the same line. + + Paths in the DAG are represented with '|', '/' and so forth. + + Returns 0 on success. + """ + revs = list(revs) + opts['rev'] + if not revs: + revs = ['.'] + revs = scmutil.revrange(repo, revs) + + if opts['graph']: + return _debugobshistorygraph(ui, repo, revs, opts) + + fm = ui.formatter('debugobshistory', opts) + revs.reverse() + _debugobshistorysingle(fm, repo, revs) + + fm.end() + class obsmarker_printer(cmdutil.changeset_printer): """show (available) information about a node