Patchwork [2,of,3,V3,part,1] transplant: replace incancestors uses with ancestors

login
register
mail settings
Submitter Siddharth Agarwal
Date Dec. 17, 2012, 11:19 p.m.
Message ID <edac5d9c4d2e12e3fe66.1355786376@sid0x220>
Download mbox | patch
Permalink /patch/175/
State Accepted
Commit 40f0c0748cfc7c880ca17eb4a07ad74cd00c5d99
Headers show

Comments

Siddharth Agarwal - Dec. 17, 2012, 11:19 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1355785686 28800
# Node ID edac5d9c4d2e12e3fe66fb8d60a58a2f1a966bef
# Parent  cc32dcb345b6e9d0f2b85bdd63e8262d7e12ac2a
transplant: replace incancestors uses with ancestors
Kevin Bullock - Dec. 18, 2012, 3:59 a.m.
On 17 Dec 2012, at 5:19 PM, Siddharth Agarwal wrote:

> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1355785686 28800
> # Node ID edac5d9c4d2e12e3fe66fb8d60a58a2f1a966bef
> # Parent  cc32dcb345b6e9d0f2b85bdd63e8262d7e12ac2a
> transplant: replace incancestors uses with ancestors
> 
> diff -r cc32dcb345b6 -r edac5d9c4d2e hgext/transplant.py
> --- a/hgext/transplant.py	Mon Dec 17 15:13:51 2012 -0800
> +++ b/hgext/transplant.py	Mon Dec 17 15:08:06 2012 -0800
> @@ -94,7 +94,7 @@
>             parentrev = repo.changelog.rev(parent)
>         if hasnode(repo, node):
>             rev = repo.changelog.rev(node)
> -            reachable = repo.changelog.incancestors([parentrev], rev)
> +            reachable = repo.changelog.ancestors([parentrev], rev, True)

I'd rather see us using the keyword arg explicitly, so we know what Truth we're referring to.

>             if rev in reachable:
>                 return True
>         for t in self.transplants.get(node):
> @@ -103,7 +103,8 @@
>                 self.transplants.remove(t)
>                 return False
>             lnoderev = repo.changelog.rev(t.lnode)
> -            if lnoderev in repo.changelog.incancestors([parentrev], lnoderev):
> +            if lnoderev in repo.changelog.ancestors([parentrev], lnoderev,
> +                                                    True):

Here too.

pacem in terris / ??? / ?????? / ????????? / ??
Kevin R. Bullock

Patch

diff -r cc32dcb345b6 -r edac5d9c4d2e hgext/transplant.py
--- a/hgext/transplant.py	Mon Dec 17 15:13:51 2012 -0800
+++ b/hgext/transplant.py	Mon Dec 17 15:08:06 2012 -0800
@@ -94,7 +94,7 @@ 
             parentrev = repo.changelog.rev(parent)
         if hasnode(repo, node):
             rev = repo.changelog.rev(node)
-            reachable = repo.changelog.incancestors([parentrev], rev)
+            reachable = repo.changelog.ancestors([parentrev], rev, True)
             if rev in reachable:
                 return True
         for t in self.transplants.get(node):
@@ -103,7 +103,8 @@ 
                 self.transplants.remove(t)
                 return False
             lnoderev = repo.changelog.rev(t.lnode)
-            if lnoderev in repo.changelog.incancestors([parentrev], lnoderev):
+            if lnoderev in repo.changelog.ancestors([parentrev], lnoderev,
+                                                    True):
                 return True
         return False