convert: p4: ignore purged files with p4d 2012.2 and later
authorMads Kiilerich <madski@unity3d.com>
Mon, 25 Aug 2014 03:27:51 +0200
changeset 22294 754f208ce21d
parent 22293 a970a5c15b43
child 22295 926bc0d3b595
convert: p4: ignore purged files with p4d 2012.2 and later Perforce has the concept of "+Sn" files where only the last revisions of the file is stored. In p4d 2012.1 old purged revisions were not included in the "manifest". With 2012.2 they started being included and convert's getfile failed to recognize the "purged" flag and saw it as an empty file. That made test-convert-p4-filetypes.t fail. There is no point in storing an empty file as placeholder for a purged file so we restore the old behaviour by checking the flag and letting getfile consider purged files deleted. (It is questionable whether it makes sense to convert not-yet-purged +S files to mercurial ... but that is another question.)
hgext/convert/p4.py
--- a/hgext/convert/p4.py	Mon Aug 25 03:27:51 2014 +0200
+++ b/hgext/convert/p4.py	Mon Aug 25 03:27:51 2014 +0200
@@ -164,6 +164,8 @@
                 raise IOError(d["generic"], data)
 
             elif code == "stat":
+                if d.get("action") == "purge":
+                    return None, None
                 p4type = self.re_type.match(d["type"])
                 if p4type:
                     mode = ""