@matheusbsbs / matheus-bagliano / commits / 56c093451c
Fork 0

git-p4: accommodate new move/delete type in p4

562d53f (git-p4: Fix sync errors due to new server version, 2010-01-21) taught git-p4 sync to recognize the new move/delete type, but this type can also show up in an initial clone and labels output. Instead of replicating the support in three places, hoist the definition somewhere global. Signed-off-by: Pete Wyckoff <pw@padd.com> Acked-By: Tor Arvid Lund <torarvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Feb 19, 2011 at 08:17 UTC 56c093451c7b2b485b194943ea071aca4e74733d
1 file changed +7 -5
contrib/fast-import/git-p4
+7 -5
@@ -834,6 +834,8 @@ class P4Submit(Command):
834 return True
835
836 class P4Sync(Command):
837 + delete_actions = ( "delete", "move/delete", "purge" )
838 +
839 def __init__(self):
840 Command.__init__(self)
841 self.options = [
@@ -1038,10 +1040,10 @@ class P4Sync(Command):
1040
1041 if includeFile:
1042 filesForCommit.append(f)
1041 - if f['action'] not in ('delete', 'move/delete', 'purge'):
1042 - filesToRead.append(f)
1043 - else:
1043 + if f['action'] in self.delete_actions:
1044 filesToDelete.append(f)
1045 + else:
1046 + filesToRead.append(f)
1047
1048 # deleted files...
1049 for f in filesToDelete:
@@ -1127,7 +1129,7 @@ class P4Sync(Command):
1129
1130 cleanedFiles = {}
1131 for info in files:
1130 - if info["action"] in ("delete", "purge"):
1132 + if info["action"] in self.delete_actions:
1133 continue
1134 cleanedFiles[info["depotFile"]] = info["rev"]
1135
@@ -1453,7 +1455,7 @@ class P4Sync(Command):
1455 if change > newestRevision:
1456 newestRevision = change
1457
1456 - if info["action"] in ("delete", "purge"):
1458 + if info["action"] in self.delete_actions:
1459 # don't increase the file cnt, otherwise details["depotFile123"] will have gaps!
1460 #fileCnt = fileCnt + 1
1461 continue