2011-10-27

Import git to perforce

Import git to perforce

At work I have to use painforce, although I don't like it. So I decided to use it as kind of  a master repository for my git stuff. git-p4 is a python script that does most of what I want, however I wanted to keep the original commit date and hash. So here's a little patch to achieve this.
 
--- /usr/local/home/bjoern.henkel/git-p4.org    2011-10-27 11:56:05.351331262 +0900
+++ /usr/libexec/git-core/git-p4        2011-10-27 16:24:12.623302361 +0900
@@ -413,6 +413,14 @@
            continue

        logMessage += log
+
+    # I want to keep the original date when importing from git
+    logMessage += "\n"
+    logMessage += "Original commit date: "
+    cmd = 'git show -s --pretty="%ai (%ar) " ' + commit
+    logMessage += read_pipe(cmd)
+    logMessage += "commit: %s" % commit
+
     return logMessage

 def extractSettingsFromNotes(commit):

No comments:

Post a Comment