From ff51a98eee234e550525ee0fce9e9647df5396c2 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 13 Mar 2009 03:10:00 +0100 Subject: [PATCH] git-p4: remove tabs and unnecessary semicolons. --- contrib/fast-import/git-p4 | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 342529db30..5cfb053d94 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -12,7 +12,7 @@ import optparse, sys, os, marshal, popen2, subprocess, shelve import tempfile, getopt, sha, os.path, time, platform import re -from sets import Set; +from sets import Set verbose = False @@ -240,7 +240,7 @@ def p4Cmd(cmd): result = {} for entry in list: result.update(entry) - return result; + return result def p4Where(depotPath): if not depotPath.endswith("/"): @@ -281,7 +281,7 @@ def currentGitBranch(): def isValidGitDir(path): if (os.path.exists(path + "/HEAD") and os.path.exists(path + "/refs") and os.path.exists(path + "/objects")): - return True; + return True return False def parseRevision(ref): @@ -328,8 +328,8 @@ def extractSettingsGitLog(log): def gitBranchExists(branch): proc = subprocess.Popen(["git", "rev-parse", branch], - stderr=subprocess.PIPE, stdout=subprocess.PIPE); - return proc.wait() == 0; + stderr=subprocess.PIPE, stdout=subprocess.PIPE) + return proc.wait() == 0 _gitConfig = {} def gitConfig(key): @@ -444,8 +444,8 @@ def p4ChangesForPaths(depotPaths, changeRange): changes = {} for line in output: - changeNum = int(line.split(" ")[1]) - changes[changeNum] = True + changeNum = int(line.split(" ")[1]) + changes[changeNum] = True changelist = changes.keys() changelist.sort() @@ -492,7 +492,7 @@ class P4RollBack(Command): maxChange = int(args[0]) if "p4ExitCode" in p4Cmd("changes -m 1"): - die("Problems executing p4"); + die("Problems executing p4") if self.rollbackLocalBranches: refPrefix = "refs/heads/" @@ -663,7 +663,7 @@ class P4Submit(Command): if response == "s": print "Skipping! Good luck with the next patches..." for f in editedFiles: - p4_system("revert \"%s\"" % f); + p4_system("revert \"%s\"" % f) for f in filesToAdd: system("rm %s" %f) return @@ -734,7 +734,7 @@ class P4Submit(Command): if os.environ.has_key("P4EDITOR"): editor = os.environ.get("P4EDITOR") else: - editor = os.environ.get("EDITOR", defaultEditor); + editor = os.environ.get("EDITOR", defaultEditor) system(editor + " " + fileName) response = "y" @@ -753,9 +753,9 @@ class P4Submit(Command): p4_write_pipe("submit -i", submitTemplate) else: for f in editedFiles: - p4_system("revert \"%s\"" % f); + p4_system("revert \"%s\"" % f) for f in filesToAdd: - p4_system("revert \"%s\"" % f); + p4_system("revert \"%s\"" % f) system("rm %s" %f) os.remove(fileName) @@ -977,9 +977,9 @@ class P4Sync(Command): if "p4ExitCode" in filedata[0]: die("Problems executing p4. Error: [%d]." - % (filedata[0]['p4ExitCode'])); + % (filedata[0]['p4ExitCode'])) - j = 0; + j = 0 contents = {} while j < len(filedata): stat = filedata[j] @@ -1142,7 +1142,7 @@ class P4Sync(Command): s = '' for (key, val) in self.users.items(): - s += "%s\t%s\n" % (key.expandtabs(1), val.expandtabs(1)) + s += "%s\t%s\n" % (key.expandtabs(1), val.expandtabs(1)) open(self.getUserCacheFilename(), "wb").write(s) self.userMapFromPerforceServer = True @@ -1303,8 +1303,8 @@ class P4Sync(Command): def importNewBranch(self, branch, maxChange): # make fast-import flush all changes to disk and update the refs using the checkpoint # command so that we can try to find the branch parent in the git history - self.gitStream.write("checkpoint\n\n"); - self.gitStream.flush(); + self.gitStream.write("checkpoint\n\n") + self.gitStream.flush() branchPrefix = self.depotPaths[0] + branch + "/" range = "@1,%s" % maxChange #print "prefix" + branchPrefix @@ -1364,12 +1364,12 @@ class P4Sync(Command): fullBranch = self.projectName + branch if fullBranch not in self.p4BranchesInGit: if not self.silent: - print("\n Importing new branch %s" % fullBranch); + print("\n Importing new branch %s" % fullBranch) if self.importNewBranch(branch, change - 1): parent = "" self.p4BranchesInGit.append(fullBranch) if not self.silent: - print("\n Resuming with change %s" % change); + print("\n Resuming with change %s" % change) if self.verbose: print "parent determined through known branches: %s" % parent @@ -1485,7 +1485,7 @@ class P4Sync(Command): self.branch = self.refPrefix + "master" if gitBranchExists("refs/heads/p4") and self.importIntoRemotes: system("git update-ref %s refs/heads/p4" % self.branch) - system("git branch -D p4"); + system("git branch -D p4") # create it /after/ importing, when master exists if not gitBranchExists(self.refPrefix + "HEAD") and self.importIntoRemotes and gitBranchExists(self.branch): system("git symbolic-ref %sHEAD %s" % (self.refPrefix, self.branch)) @@ -1591,7 +1591,7 @@ class P4Sync(Command): self.loadUserMapFromCache() self.labels = {} if self.detectLabels: - self.getLabels(); + self.getLabels() if self.detectBranches: ## FIXME - what's a P4 projectName ? @@ -1615,7 +1615,7 @@ class P4Sync(Command): importProcess = subprocess.Popen(["git", "fast-import"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE); + stderr=subprocess.PIPE) self.gitOutput = importProcess.stdout self.gitStream = importProcess.stdin self.gitError = importProcess.stderr @@ -1688,9 +1688,9 @@ class P4Rebase(Command): def rebase(self): if os.system("git update-index --refresh") != 0: - die("Some files in your working directory are modified and different than what is in your index. You can use git update-index to bring the index up-to-date or stash away all your changes with git stash."); + die("Some files in your working directory are modified and different than what is in your index. You can use git update-index to bring the index up-to-date or stash away all your changes with git stash.") if len(read_pipe("git diff-index HEAD --")) > 0: - die("You have uncommited changes. Please commit them before rebasing or stash them away with git stash."); + die("You have uncommited changes. Please commit them before rebasing or stash them away with git stash.") [upstream, settings] = findUpstreamBranchPoint() if len(upstream) == 0: @@ -1866,7 +1866,7 @@ def main(): description = cmd.description, formatter = HelpFormatter()) - (cmd, args) = parser.parse_args(sys.argv[2:], cmd); + (cmd, args) = parser.parse_args(sys.argv[2:], cmd) global verbose verbose = cmd.verbose if cmd.needsGit: @@ -1877,7 +1877,7 @@ def main(): if os.path.exists(cmd.gitdir): cdup = read_pipe("git rev-parse --show-cdup").strip() if len(cdup) > 0: - chdir(cdup); + chdir(cdup) if not isValidGitDir(cmd.gitdir): if isValidGitDir(cmd.gitdir + "/.git"): -- 2.11.4.GIT