mercurial/commands.py
changeset 22274 10e87c67f1c7
parent 22273 e6d01239f779
child 22277 e116abad3afa
--- a/mercurial/commands.py	Wed Aug 20 18:11:23 2014 -0700
+++ b/mercurial/commands.py	Tue Aug 19 23:22:44 2014 -0700
@@ -2310,6 +2310,7 @@
         [('', 'flags', 0, _('markers flag')),
          ('', 'record-parents', False,
           _('record parent information for the precursor')),
+         ('r', 'rev', [], _('display markers relevant to REV')),
         ] + commitopts2,
          _('[OBSOLETED [REPLACEMENT] [REPL... ]'))
 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
@@ -2331,6 +2332,8 @@
                              'node identifiers')
 
     if precursor is not None:
+        if opts['rev']:
+            raise util.Abort('cannot select revision when creating marker')
         metadata = {}
         metadata['user'] = opts['user'] or ui.username()
         succs = tuple(parsenodeid(succ) for succ in successors)
@@ -2363,7 +2366,15 @@
         finally:
             l.release()
     else:
-        for m in obsolete.getmarkers(repo):
+        if opts['rev']:
+            revs = scmutil.revrange(repo, opts['rev'])
+            nodes = [repo[r].node() for r in revs]
+            markers = list(obsolete.getmarkers(repo, nodes=nodes))
+            markers.sort(key=lambda x: x._data)
+        else:
+            markers = obsolete.getmarkers(repo)
+
+        for m in markers:
             cmdutil.showmarker(ui, m)
 
 @command('debugpathcomplete',