diff options
author | Pete Wyckoff <pw@padd.com> | 2012-04-29 20:57:14 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-30 15:59:01 -0700 |
commit | 8d7ec3629cb1fc315b3218a8f277545157334a86 (patch) | |
tree | 5a29cf40e4195b01d379c17cc09c78b954712ff9 /git-p4.py | |
parent | 9768cafe681a7844d5a1d067991053b25db83bbb (diff) | |
download | git-8d7ec3629cb1fc315b3218a8f277545157334a86.tar.gz git-8d7ec3629cb1fc315b3218a8f277545157334a86.tar.xz |
git p4: bring back files in deleted client directory
The code to auto-create the client directory, added in 0591cfa
(git-p4: ensure submit clientPath exists before chdir,
2011-12-09), works when the client directory never existed.
But if the directory is summarily removed without telling p4,
the sync operation will not bring back all the files. Always
do "sync -f" if the client directory is newly created.
Reported-by: Gary Gibbons <ggibbons@perforce.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-x | git-p4.py | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -135,8 +135,8 @@ def p4_system(cmd): def p4_integrate(src, dest): p4_system(["integrate", "-Dt", src, dest]) -def p4_sync(path): - p4_system(["sync", path]) +def p4_sync(f, *options): + p4_system(["sync"] + list(options) + [f]) def p4_add(f): p4_system(["add", f]) @@ -1361,12 +1361,18 @@ class P4Submit(Command, P4UserMap): self.oldWorkingDirectory = os.getcwd() # ensure the clientPath exists + new_client_dir = False if not os.path.exists(self.clientPath): + new_client_dir = True os.makedirs(self.clientPath) chdir(self.clientPath) print "Synchronizing p4 checkout..." - p4_sync("...") + if new_client_dir: + # old one was destroyed, and maybe nobody told p4 + p4_sync("...", "-f") + else: + p4_sync("...") self.check() commits = [] |