aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2007-05-23 18:49:35 -0300
committerHan-Wen Nienhuys <hanwen@google.com>2007-05-30 16:35:32 -0300
commit183b8ef89be041cd50803427cfc46fe1afed17bb (patch)
tree88ca9a5c252a5c7fb7f8a8c2590d937142bc06fd
parent9320da8dd492c13f1d32b7fde8c9e60bdbd10217 (diff)
downloadgit-183b8ef89be041cd50803427cfc46fe1afed17bb.tar.gz
git-183b8ef89be041cd50803427cfc46fe1afed17bb.tar.xz
store p4 user cache in home directory.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
-rwxr-xr-xcontrib/fast-import/git-p415
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index f1f562fae..bd1afb296 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -819,6 +819,9 @@ class P4Sync(Command):
print ("Tag %s does not match with change %s: file count is different."
% (labelDetails["label"], change))
+ def getUserCacheFilename(self):
+ return os.environ["HOME"] + "/.gitp4-usercache.txt")
+
def getUserMapFromPerforceServer(self):
if self.userMapFromPerforceServer:
return
@@ -829,17 +832,19 @@ class P4Sync(Command):
continue
self.users[output["User"]] = output["FullName"] + " <" + output["Email"] + ">"
- cache = open(self.gitdir + "/p4-usercache.txt", "wb")
- for user in self.users.keys():
- cache.write("%s\t%s\n" % (user, self.users[user]))
- cache.close();
+
+ s = ''
+ for (key, val) in self.users.items():
+ s += "%s\t%s\n" % (key, val)
+
+ open(self.getUserCacheFilename(), "wb").write(s)
self.userMapFromPerforceServer = True
def loadUserMapFromCache(self):
self.users = {}
self.userMapFromPerforceServer = False
try:
- cache = open(self.gitdir + "/p4-usercache.txt", "rb")
+ cache = open(self.getUserCacheFilename(), "rb")
lines = cache.readlines()
cache.close()
for line in lines: