From: Han-Wen Nienhuys Date: Wed, 23 May 2007 21:49:35 +0000 (-0300) Subject: store p4 user cache in home directory. X-Git-Tag: v1.5.3-rc0~65^2^2~31 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=183b8ef89be041cd50803427cfc46fe1afed17bb;p=git.git store p4 user cache in home directory. Signed-off-by: Han-Wen Nienhuys --- 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: