Skip to contentSkip to conversation

Git-p4: Add "git p4 change" command.

PATCH In review Andrei Warkentin 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Git-p4: Add "git p4 change" command.

Many users of p4/sd use changelists for review, regression tests and batch builds.

"p4 change" is almost equivalent to "p4 submit", yet will just create the changelist and not submit it.

---
 contrib/fast-import/git-p4     |   16 ++++++++++++----
 contrib/fast-import/git-p4.txt |   10 ++++++++++
 2 files changed, 22 insertions(+), 4 deletions(-)
contrib/fast-import/git-p4 +12 -4
index 2f7b270..19c295b 100755
@@ -959,7 +959,10 @@ class P4Submit(Command, P4UserMap):
                 submitTemplate = message[:message.index(separatorLine)]
                 if self.isWindows:
                     submitTemplate = submitTemplate.replace("\r\n", "\n")
-                p4_write_pipe("submit -i", submitTemplate)
+                if gitConfig("git-p4.changeOnSubmit"):
+                    p4_write_pipe("change -i", submitTemplate)
+                else:
+                    p4_write_pipe("subadasdmit -i", submitTemplate)
 
                 if self.preserveUser:
                     if p4User:
@@ -981,9 +984,14 @@ class P4Submit(Command, P4UserMap):
             file = open(fileName, "w+")
             file.write(self.prepareLogMessage(template, logMessage))
             file.close()
-            print ("Perforce submit template written as %s. "
-                   + "Please review/edit and then use p4 submit -i < %s to submit directly!"
-                   % (fileName, fileName))
+            if gitConfig("git-p4.changeOnSubmit"):
+                print ("Perforce submit template written as %s. "
+                       + "Please review/edit and then use p4 change -i < %s to create changelist!"
+                       % (fileName, fileName))
+            else:
+                print ("Perforce submit template written as %s. "
+                       + "Please review/edit and then use p4 submit -i < %s to submit directly!"
+                       % (fileName, fileName))
 
     def run(self, args):
         if len(args) == 0:
contrib/fast-import/git-p4.txt +10 -0
index 52003ae..3a3a815 100644
@@ -180,6 +180,16 @@ git-p4.allowSubmit
 
   git config [--global] git-p4.allowSubmit false
 
+git-p4.changeOnSubmit
+
+  git config [--global] git-p4.changeOnSubmit false
+
+Most places using p4/sourcedepot don't actually want you submit
+changes directly, and changelists are used to do regression testing,
+batch builds and review, hence, by setting this parameter to
+true you acknowledge you end up creating a changelist which you
+must then manually commit.
+
 git-p4.syncFromOrigin
 
 A useful setup may be that you have a periodically updated git repository
Signature · 1 line
1.7.4.1
#1 lore raw

----- Original Message -----

Quoted 6 lines

From: "Andrei Warkentin" <[email protected]>
To: [email protected], [email protected]
Cc: "Andrei Warkentin" <[email protected]>
Sent: Monday, October 17, 2011 6:16:38 PM
Subject: [PATCH] Git-p4: Add "git p4 change" command.

Quoted 8 lines

Many users of p4/sd use changelists for review, regression tests and batch builds.

"p4 change" is almost equivalent to "p4 submit", yet will just create the changelist and not submit it.

---

Sorry for the spam, this is the wrong patch :-(.

A