summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2015-01-17 20:56:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-02-11 21:38:29 (GMT)
commit51334bb094e085728ffe2b603fa3fe41dd80c075 (patch)
tree3bff3c9a3ea94514f9b2eb8c1cc2f0c59462c68f /git-p4.py
parentfdf96a20acf96a6ac538df8113b2aafd6ed71d50 (diff)
downloadgit-51334bb094e085728ffe2b603fa3fe41dd80c075.zip
git-51334bb094e085728ffe2b603fa3fe41dd80c075.tar.gz
git-51334bb094e085728ffe2b603fa3fe41dd80c075.tar.bz2
git-p4: support excluding paths on sync
The clone subcommand has long had support for excluding subdirectories, but sync has not. This is a nuisance, since as soon as you do a sync, any changed files that were initially excluded start showing up. Move the "exclude" command-line option into the parent class; the actual behavior was already present there so it simply had to be exposed. Signed-off-by: Luke Diamand <luke@diamand.org> Reviewed-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/git-p4.py b/git-p4.py
index ff132b2..ad91057 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1915,7 +1915,10 @@ class P4Sync(Command, P4UserMap):
optparse.make_option("--keep-path", dest="keepRepoPath", action='store_true',
help="Keep entire BRANCH/DIR/SUBDIR prefix during import"),
optparse.make_option("--use-client-spec", dest="useClientSpec", action='store_true',
- help="Only sync files that are included in the Perforce Client Spec")
+ help="Only sync files that are included in the Perforce Client Spec"),
+ optparse.make_option("-/", dest="cloneExclude",
+ action="append", type="string",
+ help="exclude depot path"),
]
self.description = """Imports from Perforce into a git repository.\n
example:
@@ -1950,6 +1953,12 @@ class P4Sync(Command, P4UserMap):
if gitConfig("git-p4.syncFromOrigin") == "false":
self.syncWithOrigin = False
+ # This is required for the "append" cloneExclude action
+ def ensure_value(self, attr, value):
+ if not hasattr(self, attr) or getattr(self, attr) is None:
+ setattr(self, attr, value)
+ return getattr(self, attr)
+
# Force a checkpoint in fast-import and wait for it to finish
def checkpoint(self):
self.gitStream.write("checkpoint\n\n")
@@ -3101,9 +3110,6 @@ class P4Clone(P4Sync):
optparse.make_option("--destination", dest="cloneDestination",
action='store', default=None,
help="where to leave result of the clone"),
- optparse.make_option("-/", dest="cloneExclude",
- action="append", type="string",
- help="exclude depot path"),
optparse.make_option("--bare", dest="cloneBare",
action="store_true", default=False),
]
@@ -3111,12 +3117,6 @@ class P4Clone(P4Sync):
self.needsGit = False
self.cloneBare = False
- # This is required for the "append" cloneExclude action
- def ensure_value(self, attr, value):
- if not hasattr(self, attr) or getattr(self, attr) is None:
- setattr(self, attr, value)
- return getattr(self, attr)
-
def defaultDestination(self, args):
## TODO: use common prefix of args?
depotPath = args[0]