Patchwork [4,of,7,evolve-ext] evolve: fix crash in _orderrevs

login
register
mail settings
Submitter timeless@gcc2-power8.osuosl.org
Date April 14, 2016, 3:05 p.m.
Message ID <48cb89ebf3625ad386be.1460646319@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/14611/
State Deferred
Headers show

Comments

timeless@gcc2-power8.osuosl.org - April 14, 2016, 3:05 p.m.
# HG changeset patch
# User timeless@gmail.com
# Date 1460605333 0
#      Thu Apr 14 03:42:13 2016 +0000
# Node ID 48cb89ebf3625ad386be7d1941b725b8e64d5db9
# Parent  6d5f4ff81952cbc23f196b60bcd298495b99e5e3
# Available At https://bitbucket.org/timeless/mutable-history/
#              hg pull https://bitbucket.org/timeless/mutable-history/ -r 48cb89ebf362
evolve: fix crash in _orderrevs
Pierre-Yves David - April 14, 2016, 6:45 p.m.
On 04/14/2016 08:05 AM, timeless@gcc2-power8.osuosl.org wrote:

^ You probably want to fix your sender email to not say 
@gcc2-power8.osuosl.org

> # HG changeset patch
> # User timeless@gmail.com
> # Date 1460605333 0
> #      Thu Apr 14 03:42:13 2016 +0000
> # Node ID 48cb89ebf3625ad386be7d1941b725b8e64d5db9
> # Parent  6d5f4ff81952cbc23f196b60bcd298495b99e5e3
> # Available At https://bitbucket.org/timeless/mutable-history/
> #              hg pull https://bitbucket.org/timeless/mutable-history/ -r 48cb89ebf362
> evolve: fix crash in _orderrevs

Can you elaborate on what cause the crash situation and why this is a 
good fix?

> diff -r 6d5f4ff81952 -r 48cb89ebf362 hgext/evolve.py
> --- a/hgext/evolve.py	Wed Apr 13 23:36:44 2016 +0000
> +++ b/hgext/evolve.py	Thu Apr 14 03:42:13 2016 +0000
> @@ -1509,7 +1509,8 @@
>       while solvablerevs:
>           rev = solvablerevs.popleft()
>           for dependent in rdependencies[rev]:
> -            dependencies[dependent].remove(rev)
> +            if rev in dependencies[dependent]:
> +                dependencies[dependent].remove(rev)

You are looking for

dependencies[dependent].discard(rev)

Patch

diff -r 6d5f4ff81952 -r 48cb89ebf362 hgext/evolve.py
--- a/hgext/evolve.py	Wed Apr 13 23:36:44 2016 +0000
+++ b/hgext/evolve.py	Thu Apr 14 03:42:13 2016 +0000
@@ -1509,7 +1509,8 @@ 
     while solvablerevs:
         rev = solvablerevs.popleft()
         for dependent in rdependencies[rev]:
-            dependencies[dependent].remove(rev)
+            if rev in dependencies[dependent]:
+                dependencies[dependent].remove(rev)
             if not dependencies[dependent]:
                 solvablerevs.append(dependent)
         del dependencies[rev]