Patchwork [issue4737] shelve: rename 'publicancestors' to something accurate (issue4737)

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 12, 2015, 4:06 p.m.
Message ID <4b05da57ecc9e19900e5.1444666019@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10960/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 12, 2015, 4:06 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1444429910 25200
#      Fri Oct 09 15:31:50 2015 -0700
# Node ID 4b05da57ecc9e19900e59265a9a0383ce0ad9208
# Parent  9ca13d10881d7044b79d903ad64653f6541591f1
# EXP-Topic issue4737
shelve: rename 'publicancestors' to something accurate (issue4737)

That function is actually not returning public ancestors at all. This is
pointed by the second line of the docstring...

The bundling behavior was made correct in a5141977198d but with confusion
remaining regarding what each function was doing.

This close issue4737, because this highlight that shelve is actually -not-
bundling too much data (this was actually properly tested).
Augie Fackler - Oct. 12, 2015, 5:09 p.m.
On Mon, Oct 12, 2015 at 09:06:59AM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1444429910 25200
> #      Fri Oct 09 15:31:50 2015 -0700
> # Node ID 4b05da57ecc9e19900e59265a9a0383ce0ad9208
> # Parent  9ca13d10881d7044b79d903ad64653f6541591f1
> # EXP-Topic issue4737
> shelve: rename 'publicancestors' to something accurate (issue4737)

Queued, thanks.

>
> That function is actually not returning public ancestors at all. This is
> pointed by the second line of the docstring...
>
> The bundling behavior was made correct in a5141977198d but with confusion
> remaining regarding what each function was doing.
>
> This close issue4737, because this highlight that shelve is actually -not-
> bundling too much data (this was actually properly tested).
>
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> --- a/hgext/shelve.py
> +++ b/hgext/shelve.py
> @@ -217,12 +217,12 @@ def _aborttransaction(repo):
>              repo.vfs.unlink(dirstatebackup)
>
>  def createcmd(ui, repo, pats, opts):
>      """subcommand that creates a new shelve"""
>
> -    def publicancestors(ctx):
> -        """Compute the public ancestors of a commit.
> +    def mutableancestors(ctx):
> +        """return all mutable ancestors for ctx (included)
>
>          Much faster than the revset ancestors(ctx) & draft()"""
>          seen = set([nullrev])
>          visit = collections.deque()
>          visit.append(ctx)
> @@ -324,11 +324,11 @@ def createcmd(ui, repo, pats, opts):
>                              "'hg status')\n") % len(stat.deleted))
>              else:
>                  ui.status(_("nothing changed\n"))
>              return 1
>
> -        bases = list(publicancestors(repo[node]))
> +        bases = list(mutableancestors(repo[node]))
>          shelvedfile(repo, name, 'hg').writebundle(bases, node)
>          cmdutil.export(repo, [node],
>                         fp=shelvedfile(repo, name, 'patch').opener('wb'),
>                         opts=mdiff.diffopts(git=True))
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -217,12 +217,12 @@  def _aborttransaction(repo):
             repo.vfs.unlink(dirstatebackup)
 
 def createcmd(ui, repo, pats, opts):
     """subcommand that creates a new shelve"""
 
-    def publicancestors(ctx):
-        """Compute the public ancestors of a commit.
+    def mutableancestors(ctx):
+        """return all mutable ancestors for ctx (included)
 
         Much faster than the revset ancestors(ctx) & draft()"""
         seen = set([nullrev])
         visit = collections.deque()
         visit.append(ctx)
@@ -324,11 +324,11 @@  def createcmd(ui, repo, pats, opts):
                             "'hg status')\n") % len(stat.deleted))
             else:
                 ui.status(_("nothing changed\n"))
             return 1
 
-        bases = list(publicancestors(repo[node]))
+        bases = list(mutableancestors(repo[node]))
         shelvedfile(repo, name, 'hg').writebundle(bases, node)
         cmdutil.export(repo, [node],
                        fp=shelvedfile(repo, name, 'patch').opener('wb'),
                        opts=mdiff.diffopts(git=True))