obslog: uniformize `_debugobshistoryrevs` and `_debugobshistorygraph` arguments
authorAlain Leufroy
Fri, 08 Sep 2017 12:24:22 +0200
changeset 2955 b899a94472fd
parent 2954 54f7b8fcdf3b
child 2956 bc9bc1778463
obslog: uniformize `_debugobshistoryrevs` and `_debugobshistorygraph` arguments `_debugobshistoryrevs` and `_debugobshistorygraph` perform quite the same action, the latter simply add graph support. Consequently, it looks better for them to have the same argument list.
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Sun Sep 17 12:45:28 2017 +0200
+++ b/hgext3rd/evolve/obshistory.py	Fri Sep 08 12:24:22 2017 +0200
@@ -74,11 +74,8 @@
     if opts['graph']:
         return _debugobshistorygraph(ui, repo, revs, opts)
 
-    fm = ui.formatter('debugobshistory', opts)
     revs.reverse()
-    _debugobshistoryrevs(fm, repo, revs, opts)
-
-    fm.end()
+    _debugobshistoryrevs(ui, repo, revs, opts)
 
 class obsmarker_printer(cmdutil.changeset_printer):
     """show (available) information about a node
@@ -106,6 +103,7 @@
             markerfm.end()
 
             markerfm.plain('\n')
+            fm.end()
             self.hunk[ctx.node()] = self.ui.popbuffer()
         else:
             ### graph output is buffered only
@@ -355,9 +353,10 @@
     walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False))
     cmdutil.displaygraph(ui, repo, walker, displayer, edges)
 
-def _debugobshistoryrevs(fm, repo, revs, opts):
+def _debugobshistoryrevs(ui, repo, revs, opts):
     """ Display the obsolescence history for revset
     """
+    fm = ui.formatter('debugobshistory', opts)
     precursors = repo.obsstore.predecessors
     successors = repo.obsstore.successors
     nodec = repo.changelog.node
@@ -384,6 +383,7 @@
             if p[0] not in seen:
                 seen.add(p[0])
                 nodes.append(p[0])
+    fm.end()
 
 def _debugobshistorydisplaynode(fm, repo, node):
     if node in repo: