Patchwork [evolve-ext] evolve: duplicate evolution summary entries (issue5014)

login
register
mail settings
Submitter Laurent Charignon
Date Dec. 30, 2015, 10:06 p.m.
Message ID <4640f0c88686138a9a5e.1451513187@lcharignon-mbp.local>
Download mbox | patch
Permalink /patch/12422/
State Changes Requested
Delegated to: Pierre-Yves David
Headers show

Comments

Laurent Charignon - Dec. 30, 2015, 10:06 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1451513163 28800
#      Wed Dec 30 14:06:03 2015 -0800
# Node ID 4640f0c88686138a9a5e41e6c2b2cbd1ba4aef21
# Parent  526253198860fdbdcae01380ae97727195039f44
evolve: duplicate evolution summary entries (issue5014)

Since we added summary entries for trouble changesets in core we don't need to
display it anymore in evolve for the version of hg with the change. Tested with
3.6.1 and 3.6.2.
Sean Farley - Dec. 31, 2015, 6:04 p.m.
Laurent Charignon <lcharignon@fb.com> writes:

> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1451513163 28800
> #      Wed Dec 30 14:06:03 2015 -0800
> # Node ID 4640f0c88686138a9a5e41e6c2b2cbd1ba4aef21
> # Parent  526253198860fdbdcae01380ae97727195039f44
> evolve: duplicate evolution summary entries (issue5014)
>
> Since we added summary entries for trouble changesets in core we don't need to
> display it anymore in evolve for the version of hg with the change. Tested with
> 3.6.1 and 3.6.2.
>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -764,13 +764,18 @@ def summaryhook(ui, repo):
>              ui.write(s)
>          else:
>              ui.note(s)
> -
> -    nbunstable = len(getrevs(repo, 'unstable'))
> -    nbbumped = len(getrevs(repo, 'bumped'))
> -    nbdivergent = len(getrevs(repo, 'divergent'))
> -    write('unstable: %i changesets\n', nbunstable)
> -    write('bumped: %i changesets\n', nbbumped)
> -    write('divergent: %i changesets\n', nbdivergent)
> +    # no util.versiontuple before 3.6.2 so we parse the version here
> +    versiontuple = tuple(map(int, util.version().split("+")[0].split(".")))

If there is no util.versiontuple until 3.6.2 then can't we just use a
try/except around that attribute?
Laurent Charignon - Jan. 4, 2016, 6:13 p.m.
> On Dec 31, 2015, at 10:04 AM, Sean Farley <sean@farley.io> wrote:
> 
> 
> Laurent Charignon <lcharignon@fb.com> writes:
> 
>> # HG changeset patch
>> # User Laurent Charignon <lcharignon@fb.com>
>> # Date 1451513163 28800
>> #      Wed Dec 30 14:06:03 2015 -0800
>> # Node ID 4640f0c88686138a9a5e41e6c2b2cbd1ba4aef21
>> # Parent  526253198860fdbdcae01380ae97727195039f44
>> evolve: duplicate evolution summary entries (issue5014)
>> 
>> Since we added summary entries for trouble changesets in core we don't need to
>> display it anymore in evolve for the version of hg with the change. Tested with
>> 3.6.1 and 3.6.2.
>> 
>> diff --git a/hgext/evolve.py b/hgext/evolve.py
>> --- a/hgext/evolve.py
>> +++ b/hgext/evolve.py
>> @@ -764,13 +764,18 @@ def summaryhook(ui, repo):
>>             ui.write(s)
>>         else:
>>             ui.note(s)
>> -
>> -    nbunstable = len(getrevs(repo, 'unstable'))
>> -    nbbumped = len(getrevs(repo, 'bumped'))
>> -    nbdivergent = len(getrevs(repo, 'divergent'))
>> -    write('unstable: %i changesets\n', nbunstable)
>> -    write('bumped: %i changesets\n', nbbumped)
>> -    write('divergent: %i changesets\n', nbdivergent)
>> +    # no util.versiontuple before 3.6.2 so we parse the version here
>> +    versiontuple = tuple(map(int, util.version().split("+")[0].split(".")))
> 
> If there is no util.versiontuple until 3.6.2 then can't we just use a
> try/except around that attribute?

Sure we can do that, that seems more hacky but shorter.
I sent a V2.

Thanks,

Laurent

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -764,13 +764,18 @@  def summaryhook(ui, repo):
             ui.write(s)
         else:
             ui.note(s)
-
-    nbunstable = len(getrevs(repo, 'unstable'))
-    nbbumped = len(getrevs(repo, 'bumped'))
-    nbdivergent = len(getrevs(repo, 'divergent'))
-    write('unstable: %i changesets\n', nbunstable)
-    write('bumped: %i changesets\n', nbbumped)
-    write('divergent: %i changesets\n', nbdivergent)
+    # no util.versiontuple before 3.6.2 so we parse the version here
+    versiontuple = tuple(map(int, util.version().split("+")[0].split(".")))
+    if versiontuple < (3, 6, 2):
+        nbunstable = len(getrevs(repo, 'unstable'))
+        nbbumped = len(getrevs(repo, 'bumped'))
+        nbdivergent = len(getrevs(repo, 'divergent'))
+        write('unstable: %i changesets\n', nbunstable)
+        write('bumped: %i changesets\n', nbbumped)
+        write('divergent: %i changesets\n', nbdivergent)
+    else:
+        # In 3.6.2, summary in core gained this feature, no need to display it
+        pass
 
 @eh.extsetup
 def obssummarysetup(ui):
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -390,7 +390,7 @@  Test rollback support
   commit: 1 deleted, 2 unknown (clean)
   update: 2 new changesets, 2 branch heads (merge)
   phases: 4 draft
-  unstable: 1 changesets
+  unstable: 1 changeset
   $ qlog
   6
   - 909a0fb57e5d
@@ -664,7 +664,7 @@  Check divergence detection (note: multip
   commit: (clean)
   update: (2|9|11) new changesets, (3|9|10) branch heads \(merge\) (re)
   phases: 3 draft
-  bumped: 1 changesets
+  bumped: 1 changeset
   $ hg debugobsolete `getid a7a6f2b5d8a5` `getid 50f11e5e3a63`
   $ hg log -r 'divergent()'
   changeset:   12:6db5e282cb91