From: Pete Wyckoff <pw@padd.com>
To: git@vger.kernel.org
Cc: Gary Gibbons <ggibbons@perforce.com>, Luke Diamand <luke@diamand.org>
Subject: [PATCH 1/4] git p4: bring back files in deleted client directory
Date: Sun, 29 Apr 2012 20:57:14 -0400 [thread overview]
Message-ID: <1335747437-24034-2-git-send-email-pw@padd.com> (raw)
In-Reply-To: <1335747437-24034-1-git-send-email-pw@padd.com>
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>
---
git-p4.py | 12 +++++++++---
t/t9807-git-p4-submit.sh | 7 +++++--
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index f910d5a..a2eba5d 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -133,8 +133,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])
@@ -1279,12 +1279,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 = []
diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
index 1541716..2d7dc27 100755
--- a/t/t9807-git-p4-submit.sh
+++ b/t/t9807-git-p4-submit.sh
@@ -28,6 +28,11 @@ test_expect_success 'submit with no client dir' '
rm -rf "$cli" &&
git config git-p4.skipSubmitEdit true &&
git p4 submit
+ ) &&
+ (
+ cd "$cli" &&
+ test_path_is_file file1 &&
+ test_path_is_file file2
)
'
@@ -44,7 +49,6 @@ test_expect_success 'submit --origin' '
) &&
(
cd "$cli" &&
- p4 sync &&
test_path_is_missing "file3.t" &&
test_path_is_file "file4.t"
)
@@ -79,7 +83,6 @@ test_expect_success 'submit with master branch name from argv' '
) &&
(
cd "$cli" &&
- p4 sync &&
test_path_is_file "file6.t" &&
test_path_is_missing "file7.t"
)
--
1.7.10.366.g90ade
next prev parent reply other threads:[~2012-04-30 0:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 0:57 [PATCH 0/4] git p4 submit fixes Pete Wyckoff
2012-04-30 0:57 ` Pete Wyckoff [this message]
2012-04-30 6:55 ` [PATCH 1/4] git p4: bring back files in deleted client directory Luke Diamand
2012-04-30 12:36 ` Pete Wyckoff
2012-04-30 18:34 ` Luke Diamand
2012-04-30 21:56 ` Pete Wyckoff
2012-04-30 0:57 ` [PATCH 2/4] git p4: test submit Pete Wyckoff
2012-04-30 0:57 ` [PATCH 3/4] git p4: fix writable file after rename or copy Pete Wyckoff
2012-04-30 0:57 ` [PATCH 4/4] git p4: submit files with wildcards Pete Wyckoff
2012-04-30 18:34 ` Luke Diamand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1335747437-24034-2-git-send-email-pw@padd.com \
--to=pw@padd.com \
--cc=ggibbons@perforce.com \
--cc=git@vger.kernel.org \
--cc=luke@diamand.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).