Patchwork [STABLE] outgoing: fix possible filtering crash in outgoing (issue3814)

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 9, 2013, 8:47 p.m.
Message ID <c76622632f68a66539f7.1360442877@serpens.logilab.fr>
Download mbox | patch
Permalink /patch/909/
State Accepted
Commit e7b89b5127c2607bcaedf7c2fb0ea525df526ea6
Headers show

Comments

Pierre-Yves David - Feb. 9, 2013, 8:47 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1360432441 0
# Branch stable
# Node ID c76622632f68a66539f7468363f195a6564dd0bb
# Parent  9a06aab5981b510a22900d2686a597afe7a5dfbe
outgoing: fix possible filtering crash in outgoing (issue3814)

If there is no outgoiing changesets but we have filtered revision in outgoing.excluded
We run into a filtering related crash. The excluded revision should not be there
in the first place but discovery need cleanup in default, not stable.
Augie Fackler - Feb. 9, 2013, 10:10 p.m.
crewed

On Feb 9, 2013, at 8:47 PM, pierre-yves.david@ens-lyon.org wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1360432441 0
> # Branch stable
> # Node ID c76622632f68a66539f7468363f195a6564dd0bb
> # Parent  9a06aab5981b510a22900d2686a597afe7a5dfbe
> outgoing: fix possible filtering crash in outgoing (issue3814)
> 
> If there is no outgoiing changesets but we have filtered revision in outgoing.excluded
> We run into a filtering related crash. The excluded revision should not be there
> in the first place but discovery need cleanup in default, not stable.
> 
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -16,10 +16,14 @@ def nochangesfound(ui, repo, excluded=No
>     nodes excluded from the push/pull.
>     '''
>     secretlist = []
>     if excluded:
>         for n in excluded:
> +            if n not in repo:
> +                # discovery should not have included the filtered revision,
> +                # we have to explicitly exclude it until discovery is cleanup.
> +                continue
>             ctx = repo[n]
>             if ctx.phase() >= phases.secret and not ctx.extinct():
>                 secretlist.append(n)
> 
>     if secretlist:
> diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
> --- a/tests/test-obsolete.t
> +++ b/tests/test-obsolete.t
> @@ -863,5 +863,27 @@ This test issue 3805
>   [1]
> 
>   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
> 
> #endif
> +
> +This test issue 3814
> +
> +(nothing to push but locally hidden changeset)
> +
> +  $ cd ..
> +  $ hg init repo-issue3814
> +  $ cd repo-issue3805
> +  $ hg push -r 3816541e5485 ../repo-issue3814
> +  pushing to ../repo-issue3814
> +  searching for changes
> +  adding changesets
> +  adding manifests
> +  adding file changes
> +  added 1 changesets with 1 changes to 1 files
> +  $ hg out ../repo-issue3814
> +  comparing with ../repo-issue3814
> +  searching for changes
> +  no changes found
> +  [1]
> +
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -16,10 +16,14 @@  def nochangesfound(ui, repo, excluded=No
     nodes excluded from the push/pull.
     '''
     secretlist = []
     if excluded:
         for n in excluded:
+            if n not in repo:
+                # discovery should not have included the filtered revision,
+                # we have to explicitly exclude it until discovery is cleanup.
+                continue
             ctx = repo[n]
             if ctx.phase() >= phases.secret and not ctx.extinct():
                 secretlist.append(n)
 
     if secretlist:
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -863,5 +863,27 @@  This test issue 3805
   [1]
 
   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
 
 #endif
+
+This test issue 3814
+
+(nothing to push but locally hidden changeset)
+
+  $ cd ..
+  $ hg init repo-issue3814
+  $ cd repo-issue3805
+  $ hg push -r 3816541e5485 ../repo-issue3814
+  pushing to ../repo-issue3814
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ hg out ../repo-issue3814
+  comparing with ../repo-issue3814
+  searching for changes
+  no changes found
+  [1]
+
+