[PATCH 1 of 5 perfarce] add support for using a filemap for inclusion and/or exclusion
Dan Villiom Podlaski Christiansen
dan at cabo.dk
Sat Nov 29 14:52:08 UTC 2014
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <dan at cabo.dk>
# Date 1417271360 -3600
# Sat Nov 29 15:29:20 2014 +0100
# Node ID f84a43b809a9c59516b2e9c732352c78fafddd96
# Parent e4eedba9b6773734c2b878148800747015708a84
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
@@ -97,6 +97,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, os, re, string, sys
propertycache=util.propertycache
@@ -275,6 +276,20 @@ class p4client(object):
if self.root.endswith('/'):
self.root = self.root[:-1]
+ @propertycache
+ def filemapper(self):
+ if self.ui.config('perfarce', 'filemap'):
+ mappath = self.ui.configpath('perfarce', 'filemap')
+ else:
+ mappath = None
+
+ filemapper = filemap.filemapper(self.ui, mappath)
+
+ if filemapper.rename:
+ raise util.Abort('filemap renaming is unsupported!')
+
+ return filemapper
+
def find(self, rev=None, base=False, p4rev=None, abort=True):
'''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
@@ -557,7 +572,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'
@@ -715,7 +730,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
@@ -748,6 +765,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']
@@ -1354,6 +1373,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)
More information about the Mercurial-devel
mailing list