Patchwork [2,of,2,convert-git-progress] convert: adjust progress bar for octopus merges (issue4169)

login
register
mail settings
Submitter Augie Fackler
Date March 13, 2015, 1:43 a.m.
Message ID <31ffd2581ded094d80f0.1426210994@106.17.16.172.in-addr.arpa>
Download mbox | patch
Permalink /patch/8038/
State Superseded
Commit 603a8d09e12dfb6b734c7e07f37049e5a83e6dae
Headers show

Comments

Augie Fackler - March 13, 2015, 1:43 a.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1426210910 14400
#      Thu Mar 12 21:41:50 2015 -0400
# Node ID 31ffd2581ded094d80f06e219ddfc2ee774d4b66
# Parent  8836d4b5f3d9c129277cbb9f27bfaa78bd217324
convert: adjust progress bar for octopus merges (issue4169)

For merges, we walk the files N-1 times, where N is the number of
parents. This means that for an octopus merge with 3 parents and 2
changed files, we actually fetch 6 files. This corrects the progress
output of the convert command when such commits are encountered.
Martin von Zweigbergk - March 13, 2015, 5:42 a.m.
Looks like forgot to update the test case you added in 1/2. There's also
stray line deletion in the patch you may want to drop.

On Thu, Mar 12, 2015 at 6:44 PM Augie Fackler <raf@durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1426210910 14400
> #      Thu Mar 12 21:41:50 2015 -0400
> # Node ID 31ffd2581ded094d80f06e219ddfc2ee774d4b66
> # Parent  8836d4b5f3d9c129277cbb9f27bfaa78bd217324
> convert: adjust progress bar for octopus merges (issue4169)
>
> For merges, we walk the files N-1 times, where N is the number of
> parents. This means that for an octopus merge with 3 parents and 2
> changed files, we actually fetch 6 files. This corrects the progress
> output of the convert command when such commits are encountered.
>
> diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
> --- a/hgext/convert/convcmd.py
> +++ b/hgext/convert/convcmd.py
> @@ -413,7 +413,15 @@ class converter(object):
>              parents = [self.map.get(p, p) for p in parents]
>          except KeyError:
>              parents = [b[0] for b in pbranches]
> -        source = progresssource(self.ui, self.source, len(files))
> +        if len(parents) < 3:
> +            source = progresssource(self.ui, self.source, len(files))
> +        else:
> +            # For an octopus merge, we end up traversing the list of
> +            # changed files N-1 times. This tweak to the number of
> +            # files makes it so the progress bar doesn't overflow
> +            # itself.
> +            source = progresssource(self.ui, self.source,
> +                                    len(files) * (len(parents) - 1))
>          newnode = self.dest.putcommit(files, copies, parents, commit,
>                                        source, self.map, full)
>          source.close()
> @@ -531,4 +539,3 @@ def convert(ui, src, dest=None, revmapfi
>
>      c = converter(ui, srcc, destc, revmapfile, opts)
>      c.convert(sortmode)
> -
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Augie Fackler - March 13, 2015, 2:28 p.m.
On Fri, Mar 13, 2015 at 05:42:03AM +0000, Martin von Zweigbergk wrote:
> Looks like forgot to update the test case you added in 1/2. There's also
> stray line deletion in the patch you may want to drop.

Fixed the test. Forgot to fix the stray deletion, someone queueing can
drop that hunk if they're feeling pedantic.


>
> On Thu, Mar 12, 2015 at 6:44 PM Augie Fackler <raf@durin42.com> wrote:
>
> > # HG changeset patch
> > # User Augie Fackler <augie@google.com>
> > # Date 1426210910 14400
> > #      Thu Mar 12 21:41:50 2015 -0400
> > # Node ID 31ffd2581ded094d80f06e219ddfc2ee774d4b66
> > # Parent  8836d4b5f3d9c129277cbb9f27bfaa78bd217324
> > convert: adjust progress bar for octopus merges (issue4169)
> >
> > For merges, we walk the files N-1 times, where N is the number of
> > parents. This means that for an octopus merge with 3 parents and 2
> > changed files, we actually fetch 6 files. This corrects the progress
> > output of the convert command when such commits are encountered.
> >
> > diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
> > --- a/hgext/convert/convcmd.py
> > +++ b/hgext/convert/convcmd.py
> > @@ -413,7 +413,15 @@ class converter(object):
> >              parents = [self.map.get(p, p) for p in parents]
> >          except KeyError:
> >              parents = [b[0] for b in pbranches]
> > -        source = progresssource(self.ui, self.source, len(files))
> > +        if len(parents) < 3:
> > +            source = progresssource(self.ui, self.source, len(files))
> > +        else:
> > +            # For an octopus merge, we end up traversing the list of
> > +            # changed files N-1 times. This tweak to the number of
> > +            # files makes it so the progress bar doesn't overflow
> > +            # itself.
> > +            source = progresssource(self.ui, self.source,
> > +                                    len(files) * (len(parents) - 1))
> >          newnode = self.dest.putcommit(files, copies, parents, commit,
> >                                        source, self.map, full)
> >          source.close()
> > @@ -531,4 +539,3 @@ def convert(ui, src, dest=None, revmapfi
> >
> >      c = converter(ui, srcc, destc, revmapfile, opts)
> >      c.convert(sortmode)
> > -
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel@selenic.com
> > http://selenic.com/mailman/listinfo/mercurial-devel
> >

Patch

diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -413,7 +413,15 @@  class converter(object):
             parents = [self.map.get(p, p) for p in parents]
         except KeyError:
             parents = [b[0] for b in pbranches]
-        source = progresssource(self.ui, self.source, len(files))
+        if len(parents) < 3:
+            source = progresssource(self.ui, self.source, len(files))
+        else:
+            # For an octopus merge, we end up traversing the list of
+            # changed files N-1 times. This tweak to the number of
+            # files makes it so the progress bar doesn't overflow
+            # itself.
+            source = progresssource(self.ui, self.source,
+                                    len(files) * (len(parents) - 1))
         newnode = self.dest.putcommit(files, copies, parents, commit,
                                       source, self.map, full)
         source.close()
@@ -531,4 +539,3 @@  def convert(ui, src, dest=None, revmapfi
 
     c = converter(ui, srcc, destc, revmapfile, opts)
     c.convert(sortmode)
-