git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-p4.py: add support for filetype change
@ 2015-12-21 13:09 Romain Picard
  2015-12-26 10:26 ` Luke Diamand
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Picard @ 2015-12-21 13:09 UTC (permalink / raw)
  To: git; +Cc: Romain Picard

After changing the type of a file in the git repository, it is not possible to
"git p4 publish" the commit to perforce. This is due to the fact that the git
"T" status is not handled in git-p4.py. This can typically occur when replacing
an existing file with a symbolic link.

The "T" modifier is now supported in git-p4.py. When a file type has changed,
inform perforce with the "p4 edit -f auto" command.

Signed-off-by: Romain Picard <romain.picard@oakbits.com>
---
 git-p4.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index a7ec118..b7a3494 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -240,8 +240,8 @@ def p4_add(f):
 def p4_delete(f):
     p4_system(["delete", wildcard_encode(f)])
 
-def p4_edit(f):
-    p4_system(["edit", wildcard_encode(f)])
+def p4_edit(f, *options):
+    p4_system(["edit"] + list(options) + [wildcard_encode(f)])
 
 def p4_revert(f):
     p4_system(["revert", wildcard_encode(f)])
@@ -1344,6 +1344,7 @@ class P4Submit(Command, P4UserMap):
 
         diff = read_pipe_lines("git diff-tree -r %s \"%s^\" \"%s\"" % (self.diffOpts, id, id))
         filesToAdd = set()
+        filesToChangeType = set()
         filesToDelete = set()
         editedFiles = set()
         pureRenameCopy = set()
@@ -1404,6 +1405,8 @@ class P4Submit(Command, P4UserMap):
                     os.unlink(dest)
                     filesToDelete.add(src)
                 editedFiles.add(dest)
+            elif modifier == "T":
+                filesToChangeType.add(path)
             else:
                 die("unknown modifier %s for %s" % (modifier, path))
 
@@ -1463,6 +1466,8 @@ class P4Submit(Command, P4UserMap):
         #
         system(applyPatchCmd)
 
+        for f in filesToChangeType:
+            p4_edit(f, "-t", "auto")
         for f in filesToAdd:
             p4_add(f)
         for f in filesToDelete:
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-29 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-21 13:09 [PATCH] git-p4.py: add support for filetype change Romain Picard
2015-12-26 10:26 ` Luke Diamand
2015-12-29 17:33   ` Romain Picard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).