Commits

Dan Villiom Podlaski Christiansen committed 0057614

New patches; rebased.

Comments (0)

Files changed (14)

advance-phases.diff

+# HG changeset patch
+# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+# Date 1344426357 -7200
+# Node ID b979e3e6a56f9325f0a09be98016b93b84d134b0
+# Parent  0d814a546a677a67dc9ab0f6ebee5cd3394d8316
+mark pulled changesets as public (using phases, introduced in Mercurial 2.1)
+
+diff --git a/perfarce.py b/perfarce.py
+--- a/perfarce.py
++++ b/perfarce.py
+@@ -107,6 +107,12 @@ except ImportError:
+     util_setflags = util.set_flags
+     revpair = cmdutil.revpair
+ 
++try:
++    from mercurial import phases
++    phases.advanceboundary
++except ImportError:
++    phases = None
++
+ from mercurial import revset
+ from mercurial import templatekw
+ 
+@@ -1224,6 +1230,9 @@ def pull(original, ui, repo, source=None
+             p4rev = repo.commitctx(ctx)
+             ctx = repo[p4rev]
+ 
++            if phases:
++                phases.advanceboundary(repo, phases.public, [ctx.node()])
++
+             for l in client.labels(c):
+                 tags[l] = (c, ctx.hex())
+ 
+@@ -1266,6 +1275,9 @@ def pull(original, ui, repo, source=None
+                 ctx = repo[p4rev]
+                 ui.note(_('added changeset %d:%s\n') % (ctx.rev(), ctx))
+ 
++                if phases:
++                    phases.advanceboundary(repo, phases.public, [ctx.node()])
++
+             finally:
+                 lock.release()
+                 del lock

drop-fstat-progress.diff

 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
 # Date 1324407363 -3600
-# Node ID 6973e601e2c783ddd507552fcec9d7bb2521bd1f
-# Parent  5a6b061a9f3f2f508f2dd8c55f976ff89bda762e
+# Node ID 58e6440e8b1c08e46210b96ce7856d52a7548dd0
+# Parent  1b57df1d248f487f8decccf964db21f2fb1e9d3e
 drop indeterminate progress for fstat - it's too spammy
 
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -672,13 +672,6 @@ class p4client(object):
+@@ -684,13 +684,6 @@ class p4client(object):
              p4cmd = 'fstat -e %d %s' % (change, util.shellquote('%s...' % self.partial))
  
          for d in self.run(p4cmd):
              if 'desc' in d or d['clientFile'].startswith('.hg'):
                  continue
              else:
-@@ -689,8 +682,6 @@ class p4client(object):
+@@ -701,8 +694,6 @@ class p4client(object):
                  ac = d['headAction']
                  result.append((df, int(rv), tp, self.actions[ac], lf))
  

drop-mercurial-node-id.diff

 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
 # Date 1325509599 -3600
-# Node ID caa16cc7fb938ab7a7cb1daa7db2125140f18507
-# Parent  21fda29e24bc649eb33300c7d6905862808daa16
+# Node ID 662e9c49ba18f592bdbddaa13a2c9d4ec1b268f9
+# Parent  92bdc3ab1e15e575b88bf78ae930efa4df3253d3
 don't include the Mercurial node ID in Perforce changelists
 
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -1031,7 +1031,7 @@ class p4client(object):
+@@ -1043,7 +1043,7 @@ class p4client(object):
              h = []
          h.append(repo[nodes[-1]].hex())
  
 # HG changeset patch
-# Parent 2e6f8142b7435e423fdef762acec6d387b561212
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+# Date 1344426233 -7200
+# Node ID ad331270f052e769146e52863e69b23666535df4
+# Parent  c43d710b0bdbe6deb3c046c737b510e055aeca1f
 swallow slightly fewer exceptions
 
 Assuming that *all* errors mean that the current repository isn't
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -160,7 +160,7 @@ class p4client(object):
-         'initialize a p4client class from the remote path'
- 
-         if not path.startswith('p4://'):
--            raise util.Abort(_('%s not a p4 repository') % path)
-+            raise error.RepoError(_('%s not a p4 repository') % path)
- 
-         try:
-             self.ui = ui
-@@ -266,7 +266,9 @@ class p4client(object):
-                     p = self.root + '/'
-                 self.rootpart = util.pconvert(p)
- 
--        except Exception:
-+        except util.Abort:
-+            raise
-+        except error.RepoError:
-             if ui.traceback:ui.traceback()
-             raise p4notclient(_('%s is not a valid p4 client') % path)
- 
-@@ -865,9 +867,9 @@ class p4client(object):
-         source = ui.expandpath(source or 'default')
-         try:
-             client = p4client(ui, repo, source)
--        except p4notclient:
-+        except util.Abort:
-             raise
--        except Exception:
-+        except error.RepoError:
+@@ -889,6 +889,7 @@ class p4client(object):
              if ui.traceback:ui.traceback()
              return True, original(ui, repo, *(source and [source] or []), **opts)
+         except p4badclient,e:
++            if ui.traceback:ui.traceback()
+             raise util.Abort(str(e))
  
-@@ -926,9 +928,7 @@ class p4client(object):
-         dest = ui.expandpath(dest or 'default-push', dest or 'default')
-         try:
-             client = p4client(ui, repo, dest)
--        except p4notclient:
--            raise
--        except Exception:
-+        except error.RepoError:
-             if ui.traceback:ui.traceback()
-             return True, original(ui, repo, *(dest and [dest] or []), **opts)
- 
-@@ -1242,9 +1242,7 @@ def clone(original, ui, source, dest=Non
- 
-     try:
-         client = p4client(ui, None, source)
--    except p4notclient:
--        raise
--    except Exception:
-+    except error.RepoError:
-         if ui.traceback:ui.traceback()
-         return original(ui, source, dest, **opts)
- 
+         # if present, --rev will be the last Perforce changeset number to get

fallbackencoding.diff

 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
 # Date 1325509589 -3600
-# Node ID 21fda29e24bc649eb33300c7d6905862808daa16
-# Parent  3068ed97e4ae38e04aa9d5dd43dba5a53466956b
+# Node ID 92bdc3ab1e15e575b88bf78ae930efa4df3253d3
+# Parent  3ab5404708942586723cbe7dc9a4e1ca4a4961ef
 add support for a fallback encoding
 
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -185,6 +185,8 @@ class p4client(object):
-                 self.encoding = emap.get(e,e)
-             else:
-                 self.encoding = ui.config('perfarce', 'encoding', None)
-+            self.fallbackencoding = ui.config('perfarce', 'fallbackencoding',
-+                                              None)
+@@ -196,6 +196,8 @@ class p4client(object):
+             self.encoding = emap.get(e,e)
+         else:
+             self.encoding = ui.config('perfarce', 'encoding', None)
++        self.fallbackencoding = ui.config('perfarce', 'fallbackencoding',
++                                          None)
  
-             # caches
-             self.clientspec = {}
-@@ -348,9 +350,21 @@ class p4client(object):
+         # caches
+         self.clientspec = {}
+@@ -360,9 +362,21 @@ class p4client(object):
  
          if self.encoding:
              try:
 # HG changeset patch
-# Parent b77afad78173c02b659073f9083abc64b419dedd
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+# Date 1344426231 -7200
+# Node ID c43d710b0bdbe6deb3c046c737b510e055aeca1f
+# Parent  3a0646317a7bc5dc80069558a1ac49dfe81a7f9a
 add support for using a filemap for inclusion and/or exclusion
 
 Due to the use of bare 'sync' for fetching changelists, we still fetch
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -92,6 +92,7 @@ Five built-in commands are overridden:
- from mercurial import cmdutil, commands, context, copies, encoding, error, extensions, hg, node, repo, util, url
+@@ -93,6 +93,7 @@ from mercurial import cmdutil, commands,
  from mercurial.node import hex, short
  from mercurial.i18n import _
+ from mercurial.error import ConfigError
 +from hgext.convert import filemap
  import marshal, tempfile, os, re, string, sys
  
  try:
-@@ -175,6 +176,12 @@ class p4client(object):
-             self.ignorecase = ui.configbool('perfarce', 'ignorecase', False)
-             self.tags = ui.configbool('perfarce', 'tags', True)
+@@ -275,6 +276,20 @@ class p4client(object):
+             if not self.rootpart.endswith('/'):
+                 self.rootpart += '/'
  
-+            self.filemapper = filemap.filemapper(ui, ui.configpath('perfarce',
-+                                                                   'filemap'))
++    @util.propertycache
++    def filemapper(self):
++        if self.ui.config('perfarce', 'filemap'):
++            mappath = self.ui.configpath('perfarce', 'filemap')
++        else:
++            mappath = None
 +
-+            if self.filemapper.rename:
-+                raise util.Abort('filemap renaming is unsupported!')
++        filemapper = filemap.filemapper(self.ui, mappath)
 +
-             # work out character set for p4 text (but not filenames)
-             emap = { 'none': 'ascii',
-                      'utf8-bom': 'utf_8_sig',
-@@ -506,7 +513,7 @@ class p4client(object):
++        if filemapper.rename:
++            raise util.Abort('filemap renaming is unsupported!')
++
++        return filemapper
++
+     def find(self, rev=None, base=False, p4rev=None):
+         '''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
+@@ -518,7 +533,7 @@ class p4client(object):
          if not path.startswith(self.rootpart):
              raise util.Abort(_('invalid p4 local path %s') % path)
  
  
      def localpath(self, path):
          'Convert a path relative to the hg root to a path in the p4 workarea'
-@@ -664,7 +671,9 @@ class p4client(object):
+@@ -676,7 +691,9 @@ class p4client(object):
          if local and files:
              r.files = []
              for d in self.run('where', files=[f for f in files]):
  
          return r
  
-@@ -690,6 +699,8 @@ class p4client(object):
+@@ -702,6 +719,8 @@ class p4client(object):
                  continue
              else:
                  lf = self.repopath(d['clientFile'])
                  df = d['depotFile']
                  rv = d['headRev']
                  tp = d['headType']
-@@ -1285,6 +1296,7 @@ def clone(original, ui, source, dest=Non
+@@ -1297,6 +1316,7 @@ def clone(original, ui, source, dest=Non
          fp.write("keep = %s\n" % client.keep)
          fp.write("lowercasepaths = %s\n" % client.lowercasepaths)
          fp.write("tags = %s\n" % client.tags)
-+        fp.write("filemap = %s\n" % ui.config('perfarce', 'filemap'))
++        fp.write("filemap = %s\n" % ui.config('perfarce', 'filemap', ''))
  
          if client.encoding:
              fp.write("encoding = %s\n" % client.encoding)

helpful-comment.diff

+# HG changeset patch
+# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+# Date 1344426375 -7200
+# Node ID b4f0882e2f3f75d4ba5a016b39802d151539f286
+# Parent  b979e3e6a56f9325f0a09be98016b93b84d134b0
+add a possibly helpful comment
+
+diff --git a/perfarce.py b/perfarce.py
+--- a/perfarce.py
++++ b/perfarce.py
+@@ -1196,6 +1196,7 @@ def pull(original, ui, repo, source=None
+                 parent = nodes[-1]
+                 hgfiles = [f for f in repo[parent].files() if f.startswith('.hg')]
+             else:
++                # this is horribly, horribly wrong
+                 parent = None
+                 hgfiles = []
+ 
+# HG changeset patch
+# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+# Date 1344426261 -7200
+# Node ID 6f9f4ba235efd2a645a83b39462d00f04d326f09
+# Parent  ad331270f052e769146e52863e69b23666535df4
+add locking during pull
+
+diff --git a/perfarce.py b/perfarce.py
+--- a/perfarce.py
++++ b/perfarce.py
+@@ -1151,6 +1151,8 @@ def pull(original, ui, repo, source=None
+     tags = {}
+ 
+     try:
++        lock = repo.lock()
++
+         for i, c in enumerate(changes, start=1):
+             ui.note(_('change %s\n') % c)
+             cl = client.describe(c)
+@@ -1225,34 +1227,46 @@ def pull(original, ui, repo, source=None
+             ui.note(_('added changeset %d:%s\n') % (ctx.rev(), ctx))
+ 
+     finally:
++        lock.release()
++        del lock
++
+         if hasattr(ui, 'progress'):
+             ui.progress('pull', None)
+ 
+         if tags:
+-            p4rev, p4id = client.find()
+-            ctx = repo[p4rev]
++            try:
++                lock = repo.lock()
+ 
+-            if '.hgtags' in ctx:
+-                tagdata = [ctx.filectx('.hgtags').data()]
+-            else:
+-                tagdata = []
++                p4rev, p4id = client.find()
++                ctx = repo[p4rev]
+ 
+-            desc = ['p4 tags']
+-            for l in sorted(tags):
+-                t = tags[l]
+-                desc.append('   %s @ %d' % (l, t[0]))
+-                tagdata.append('%s %s\n' % (t[1], l))
++                if '.hgtags' in ctx:
++                    tagdata = [ctx.filectx('.hgtags').data()]
++                else:
++                    tagdata = []
+ 
+-            def getfilectx(repo, memctx, fn):
+-                'callback to read file data'
+-                assert fn=='.hgtags'
+-                return context.memfilectx(fn, ''.join(tagdata), False, False, None)
++                desc = ['p4 tags']
++                for l in sorted(tags):
++                    t = tags[l]
++                    desc.append('   %s @ %d' % (l, t[0]))
++                    tagdata.append('%s %s\n' % (t[1], l))
+ 
+-            ctx = context.memctx(repo, (p4rev, None), '\n'.join(desc),
+-                                 ['.hgtags'], getfilectx)
+-            p4rev = repo.commitctx(ctx)
+-            ctx = repo[p4rev]
+-            ui.note(_('added changeset %d:%s\n') % (ctx.rev(), ctx))
++                def getfilectx(repo, memctx, fn):
++                    'callback to read file data'
++                    assert fn=='.hgtags'
++                    return context.memfilectx(fn, ''.join(tagdata), False,
++                                              False, None)
++
++                ctx = context.memctx(repo, (p4rev, None), '\n'.join(desc),
++                                     ['.hgtags'], getfilectx)
++                p4rev = repo.commitctx(ctx)
++                ctx = repo[p4rev]
++                ui.note(_('added changeset %d:%s\n') % (ctx.rev(), ctx))
++
++            finally:
++                lock.release()
++                del lock
++
+ 
+     if opts['update']:
+         return hg.update(repo, 'tip')

pull-progress.diff

 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
 # Date 1324483279 -3600
-# Node ID 6844d323729ed9af973cd7b527347a2833fc9a0e
-# Parent  008cddcf8a55ce8686186e771b626ae30f245c25
+# Node ID 800fa1a12eda7878cabccbf772a60f4e52368999
+# Parent  3592c6f741c43be5ef1f12ce17715046d74d0073
 show progress output for pull
 
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -1103,11 +1103,16 @@ def pull(original, ui, repo, source=None
+@@ -1115,11 +1115,16 @@ def pull(original, ui, repo, source=None
      tags = {}
  
      try:
              if client.keep:
                  if startrev:
                      client.sync(c, all=True, force=True)
-@@ -1116,6 +1121,11 @@ def pull(original, ui, repo, source=None
+@@ -1128,6 +1133,11 @@ def pull(original, ui, repo, source=None
                                  abort=False)
                      client.sync(c, force=True, files=[f[0] for f in files])
  
              nodes = client.parsenodes(cl.desc)
              if nodes:
                  parent = nodes[-1]
-@@ -1161,6 +1171,9 @@ def pull(original, ui, repo, source=None
+@@ -1173,6 +1183,9 @@ def pull(original, ui, repo, source=None
              ui.note(_('added changeset %d:%s\n') % (ctx.rev(), ctx))
  
      finally:
 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
 # Date 1324546908 -3600
-# Node ID 3068ed97e4ae38e04aa9d5dd43dba5a53466956b
-# Parent  6844d323729ed9af973cd7b527347a2833fc9a0e
+# Node ID 3ab5404708942586723cbe7dc9a4e1ca4a4961ef
+# Parent  800fa1a12eda7878cabccbf772a60f4e52368999
 write changes pulled to the console
 
 loosely inspired by hgsubversion
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -1108,6 +1108,12 @@ def pull(original, ui, repo, source=None
+@@ -1120,6 +1120,12 @@ def pull(original, ui, repo, source=None
              cl = client.describe(c)
              files = client.fstat(c, all=bool(startrev))
  

revset+templatekw.diff

 # HG changeset patch
-# Parent 06c6d3ac633f1e5f552b93881c6694146c81a7e3
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+# Date 1344426286 -7200
+# Node ID 0d814a546a677a67dc9ab0f6ebee5cd3394d8316
+# Parent  6f9f4ba235efd2a645a83b39462d00f04d326f09
 add a revset and a template keyword
 
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -106,6 +106,9 @@ except ImportError:
+@@ -107,6 +107,9 @@ except ImportError:
      util_setflags = util.set_flags
      revpair = cmdutil.revpair
  
  def uisetup(ui):
      '''monkeypatch pull and push for p4:// support'''
  
-@@ -1640,6 +1643,26 @@ def identify(ui, repo, *args, **opts):
+@@ -1689,6 +1692,26 @@ def identify(ui, repo, *args, **opts):
  
      ui.write("%s\n" % ' '.join(output))
  
 skiplist.diff
 filemap.diff
 exceptions.diff
+locking.diff
 revset+templatekw.diff
+advance-phases.diff
+helpful-comment.diff
 # HG changeset patch
-# Parent 70598668728648f9df681deb50b1ee0f57cef671
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+# Date 1337332659 -7200
+# Node ID 3a0646317a7bc5dc80069558a1ac49dfe81a7f9a
+# Parent  662e9c49ba18f592bdbddaa13a2c9d4ec1b268f9
 add support for skipping certain changesets
 
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -906,10 +906,12 @@ class p4client(object):
+@@ -905,10 +905,12 @@ class p4client(object):
          else:
              p4cmd = 'changes -s submitted -L %s' % p4cset
  

sync-progress.diff

 # HG changeset patch
 # User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
 # Date 1324407363 -3600
-# Node ID 008cddcf8a55ce8686186e771b626ae30f245c25
-# Parent  6973e601e2c783ddd507552fcec9d7bb2521bd1f
+# Node ID 3592c6f741c43be5ef1f12ce17715046d74d0073
+# Parent  58e6440e8b1c08e46210b96ce7856d52a7548dd0
 suppress progress for sync for small changelists
 
 ...and then display it for every change if need be
 diff --git a/perfarce.py b/perfarce.py
 --- a/perfarce.py
 +++ b/perfarce.py
-@@ -704,9 +704,8 @@ class p4client(object):
+@@ -716,9 +716,8 @@ class p4client(object):
          n = 0
          for d in self.run(cmd, files=[("%s@%d" % (os.path.join(self.partial, f), change)) for f in files], abort=False):
              n += 1
              code = d.get('code')
              if code == 'error':
                  data = d['data'].strip()
-@@ -715,7 +714,7 @@ class p4client(object):
+@@ -727,7 +726,7 @@ class p4client(object):
                  else:
                      raise util.Abort('p4: %s' % data)