Skip to content

Commit

Permalink
Load the user map from p4 only once at run-time.
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hausmann <simon@lst.de>
  • Loading branch information
Simon Hausmann committed May 23, 2007
1 parent b3fd1b2 commit ebd8116
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ class P4Sync(Command):
print "Tag %s does not match with change %s: file count is different." % (labelDetails["label"], change)

def getUserMapFromPerforceServer(self):
if self.userMapFromPerforceServer:
return
self.users = {}

for output in p4CmdList("users"):
Expand All @@ -708,9 +710,11 @@ class P4Sync(Command):
for user in self.users.keys():
cache.write("%s\t%s\n" % (user, self.users[user]))
cache.close();
self.userMapFromPerforceServer = True

def loadUserMapFromCache(self):
self.users = {}
self.userMapFromPerforceServer = False
try:
cache = open(gitdir + "/p4-usercache.txt", "rb")
lines = cache.readlines()
Expand Down

0 comments on commit ebd8116

Please sign in to comment.