@matheusbsbs / matheus-bagliano / commits / 794a913a00
Fork 0

Automatically operate on a temporary branch, needed for cherry-pick to work when applying changes to

files that are deleted in the future. Also do some Perforce cleaning Signed-off-by: Simon Hausmann <hausmann@kde.org>

Simon Hausmann committed Mar 14, 2007 at 17:29 UTC 794a913a0096a383560eb06e0fdf1d8331e12c0a
1 file changed +9 -1
contrib/fast-import/p4-git-sync.py
+9 -1
@@ -97,7 +97,6 @@ def system(cmd):
97 die("command failed: %s" % cmd)
98
99 def check():
100 - return
100 if len(p4CmdList("opened ...")) > 0:
101 die("You have files opened with perforce! Close them before starting the sync.")
102
@@ -115,6 +114,9 @@ def start(config):
114
115 config["commits"] = commits
116
117 + print "Creating temporary p4-sync branch from %s ..." % origin
118 + system("git checkout -f -b p4-sync %s" % origin)
119 +
120 # print "Cleaning index..."
121 # system("git checkout -f")
122
@@ -264,5 +266,11 @@ if len(commits) == 0:
266 print "No changes found to apply between %s and current HEAD" % origin
267 else:
268 print "All changes applied!"
269 + print "Deleting temporary p4-sync branch and going back to %s" % master
270 + system("git checkout %s" % master)
271 + system("git branch -D p4-sync")
272 + print "Cleaning out your perforce checkout by doing p4 edit ... ; p4 revert -a ..."
273 + system("p4 edit ...")
274 + system("p4 revert -a ...")
275 os.remove(configFile)
276