Commits

Dan Villiom Podlaski Christiansen committed 6ad2115

New patches.

Comments (0)

Files changed (4)

+# HG changeset patch
+# Parent 2e6f8142b7435e423fdef762acec6d387b561212
+# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+swallow slightly fewer exceptions
+
+Assuming that *all* errors mean that the current repository isn't
+something other than a P4 repository is just obnoxious.
+
+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:
+             if ui.traceback:ui.traceback()
+             return True, original(ui, repo, *(source and [source] or []), **opts)
+ 
+@@ -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)
+ 
+# HG changeset patch
+# Parent b77afad78173c02b659073f9083abc64b419dedd
+# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+add support for using a filemap for inclusion and/or exclusion
+
+Due to the use of bare 'sync' for fetching changelists, we still fetch
+excluded files. We just don't commit them to repository.
+
+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
+ from mercurial.node import hex, short
+ from mercurial.i18n import _
++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)
+ 
++            self.filemapper = filemap.filemapper(ui, ui.configpath('perfarce',
++                                                                   'filemap'))
++
++            if self.filemapper.rename:
++                raise util.Abort('filemap renaming is unsupported!')
++
+             # 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 not path.startswith(self.rootpart):
+             raise util.Abort(_('invalid p4 local path %s') % path)
+ 
+-        return path[len(self.rootpart):]
++        return self.filemapper(path[len(self.rootpart):])
+ 
+     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):
+         if local and files:
+             r.files = []
+             for d in self.run('where', files=[f for f in files]):
+-                r.files.append(files[d['depotFile']] + (self.repopath(d['path']),))
++                rp = self.repopath(d['path'])
++                if rp:
++                    r.files.append(files[d['depotFile']] + (rp,))
+ 
+         return r
+ 
+@@ -690,6 +699,8 @@ class p4client(object):
+                 continue
+             else:
+                 lf = self.repopath(d['clientFile'])
++                if lf is None:
++                    continue
+                 df = d['depotFile']
+                 rv = d['headRev']
+                 tp = d['headType']
+@@ -1285,6 +1296,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'))
+ 
+         if client.encoding:
+             fp.write("encoding = %s\n" % client.encoding)
 pull-status.diff
 fallbackencoding.diff
 drop-mercurial-node-id.diff
+skiplist.diff
+filemap.diff
+exceptions.diff
+# HG changeset patch
+# Parent 70598668728648f9df681deb50b1ee0f57cef671
+# User Dan Villiom Podlaski Christiansen <dan@cabo.dk>
+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):
+         else:
+             p4cmd = 'changes -s submitted -L %s' % p4cset
+ 
++        skiplist = ui.configlist('perfarce', 'skiprevs')
++
+         changes = []
+         for d in client.run(p4cmd):
+             c = int(d['change'])
+-            if startrev or c != p4id:
++            if str(c) not in skiplist and (startrev or c != p4id):
+                 changes.append(c)
+         changes.sort()
+