Patchwork [6,of,8,v4] convert: do not provide head revisions if we have no changests to import

login
register
mail settings
Submitter David Soria Parra
Date Dec. 14, 2016, 9:46 a.m.
Message ID <c6c26e238617600d0523.1481708802@devbig415.prn1.facebook.com>
Download mbox | patch
Permalink /patch/17900/
State Superseded
Headers show

Comments

David Soria Parra - Dec. 14, 2016, 9:46 a.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1481694598 28800
#      Tue Dec 13 21:49:58 2016 -0800
# Node ID c6c26e238617600d0523b44a9043d17f963f9eda
# Parent  4b9d267d2a05970d9320b83f8bf29ec99f8ab40f
convert: do not provide head revisions if we have no changests to import

Don't set a head revision in cases where we have a revmap but no
changesets to import, as convertcmd.convert() treats them as heads of
to-imported revisions.
Kostia Balytskyi - Dec. 14, 2016, 4:49 p.m.
On 12/14/16 9:46 AM, David Soria Parra wrote:
> # HG changeset patch

> # User David Soria Parra <davidsp@fb.com>

> # Date 1481694598 28800

> #      Tue Dec 13 21:49:58 2016 -0800

> # Node ID c6c26e238617600d0523b44a9043d17f963f9eda

> # Parent  4b9d267d2a05970d9320b83f8bf29ec99f8ab40f

> convert: do not provide head revisions if we have no changests to import

>

> Don't set a head revision in cases where we have a revmap but no

> changesets to import, as convertcmd.convert() treats them as heads of

> to-imported revisions.

>

> diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py

> --- a/hgext/convert/p4.py

> +++ b/hgext/convert/p4.py

> @@ -228,7 +228,7 @@

>               self.copies[change] = copies

>               lastid = change

>   

> -        if lastid:

> +        if lastid and len(self.changeset) > 0:

>               self.heads = [lastid]

So previously self.heads was initialized as a dict but later changed to 
be a list? Wow.
>   

>       def getheads(self):

> _______________________________________________

> Mercurial-devel mailing list

> Mercurial-devel@mercurial-scm.org

> https://www.mercurial-scm.org/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
@@ -228,7 +228,7 @@ 
             self.copies[change] = copies
             lastid = change
 
-        if lastid:
+        if lastid and len(self.changeset) > 0:
             self.heads = [lastid]
 
     def getheads(self):