Patchwork [3,of,3] convert: p4: ignore purged files with p4d 2012.2 and later

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 25, 2014, 1:30 a.m.
Message ID <7a4c63d9090d8b3a2f35.1408930216@localhost.localdomain>
Download mbox | patch
Permalink /patch/5592/
State Accepted
Headers show

Comments

Mads Kiilerich - Aug. 25, 2014, 1:30 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1408930071 -7200
#      Mon Aug 25 03:27:51 2014 +0200
# Node ID 7a4c63d9090d8b3a2f35e4bcade538523d49c7b8
# Parent  15d37065fe2f87cb6f7f08ec502365b616d4c4f1
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.)
Augie Fackler - Aug. 26, 2014, 7:09 p.m.
On Mon, Aug 25, 2014 at 03:30:16AM +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1408930071 -7200
> #      Mon Aug 25 03:27:51 2014 +0200
> # Node ID 7a4c63d9090d8b3a2f35e4bcade538523d49c7b8
> # Parent  15d37065fe2f87cb6f7f08ec502365b616d4c4f1
> convert: p4: ignore purged files with p4d 2012.2 and later

queued these, thanks.

>
> 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.)
>
> diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
> --- a/hgext/convert/p4.py
> +++ b/hgext/convert/p4.py
> @@ -164,6 +164,8 @@ class p4_source(converter_source):
>                  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 = ""
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
--- a/hgext/convert/p4.py
+++ b/hgext/convert/p4.py
@@ -164,6 +164,8 @@  class p4_source(converter_source):
                 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 = ""