1. Aleksey Kunitskiy
  2. perfarce


Aleksey Kunitskiy  committed b59c867

Added switch for searching nearest p4 changesets to specified one

  • Participants
  • Parent commits eb8fe8c
  • Branches default

Comments (0)

Files changed (1)

File perfarce.py

View file
  • Ignore whitespace
             raise p4notclient(_('%s is not a valid p4 client') % path)
-    def find(self, rev=None, base=False, p4rev=None):
+    def find(self, rev=None, base=False, p4rev=None, p4nearest=False):
         '''Find the most recent revision which has the p4 extra data which
         gives the p4 changelist it was converted from. If base is True then
         return the most recent child of that revision where the only changes
                     if not p4rev or p4==p4rev:
                         return ctx.node(), p4
+                    if p4nearest and p4 < p4rev:
+                        return ctx.node(), p4
                 for p in ctx.parents():
                     if p and p not in seen:
             rev = None
             rev = '.'
-        p4rev, changelist = client.find(rev=rev, base=opts.get('base'), p4rev=cl)
+        p4rev, changelist = client.find(rev=rev, base=opts.get('base'), p4rev=cl, p4nearest=opts.get('nearest'))
         ctx = repo[p4rev]
     num = opts.get('num')
         (   identify,
             [ ('b', 'base', None, _('show base revision for new incoming changes')),
               ('c', 'changelist', 0, _('identify the specified p4 changelist')),
+              ('N', 'nearest',   None, _('identify nearest p4 changelist')),
               ('i', 'id',   None, _('show global revision id')),
               ('n', 'num',  None, _('show local revision number')),
               ('p', 'p4',   None, _('show p4 revision number')),