Patchwork graphmod: update edgemap in-place

login
register
mail settings
Submitter Martijn Pieters
Date May 16, 2016, 3:42 p.m.
Message ID <8e93920d8faff3d7221f.1463413343@mjpieters-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/15149/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Martijn Pieters - May 16, 2016, 3:42 p.m.
# HG changeset patch
# User Martijn Pieters <mjpieters@fb.com>
# Date 1463413286 -3600
#      Mon May 16 16:41:26 2016 +0100
# Node ID 8e93920d8faff3d7221f424d586088d81116ee43
# Parent  5e0077e9c6c0e36a6eb8ab6c12bb8045f07bd2d1
graphmod: update edgemap in-place

The edgemap update was not actually propagated to future asciiedge calls;
update the edge state dictionary in-place instead.
Yuya Nishihara - May 18, 2016, 12:14 p.m.
On Mon, 16 May 2016 16:42:23 +0100, Martijn Pieters wrote:
> # HG changeset patch
> # User Martijn Pieters <mjpieters@fb.com>
> # Date 1463413286 -3600
> #      Mon May 16 16:41:26 2016 +0100
> # Node ID 8e93920d8faff3d7221f424d586088d81116ee43
> # Parent  5e0077e9c6c0e36a6eb8ab6c12bb8045f07bd2d1
> graphmod: update edgemap in-place

Queued, thanks.

Patch

diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
--- a/mercurial/graphmod.py
+++ b/mercurial/graphmod.py
@@ -668,8 +668,8 @@ 
             return -num <= i if num < 0 else (len(lines) - i) <= num
         for i, line in enumerate(lines):
             line[:] = [c[-1] if _drawgp(c, i) else parent for c in line]
-        edgemap = dict(
-            (e, c if len(c) < 2 else parent) for e, c in edgemap.items())
+        edgemap.update(
+            (e, (c if len(c) < 2 else parent)) for e, c in edgemap.items())
 
     # print lines
     indentation_level = max(ncols, ncols + coldiff)
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -3070,58 +3070,58 @@ 
   !\!  parent:      21:d42a756af44d
   ! !  parent:      30:6e11cd4b648f
   ! !  user:        test
-  ! .  date:        Thu Jan 01 00:00:31 1970 +0000
-  ! .  summary:     (31) expand
-  ! .
+  ! !  date:        Thu Jan 01 00:00:31 1970 +0000
+  ! !  summary:     (31) expand
+  ! !
   o !    changeset:   30:6e11cd4b648f
   !\ \   parent:      28:44ecd0b9ae99
   ! ~ !  parent:      29:cd9bb2be7593
   !   !  user:        test
-  !   .  date:        Thu Jan 01 00:00:30 1970 +0000
-  !   .  summary:     (30) expand
+  !   !  date:        Thu Jan 01 00:00:30 1970 +0000
+  !   !  summary:     (30) expand
   !  /
   o !    changeset:   28:44ecd0b9ae99
   !\ \   parent:      1:6db2ef61d156
   ! ~ !  parent:      26:7f25b6c2f0b9
   !   !  user:        test
-  !   .  date:        Thu Jan 01 00:00:28 1970 +0000
-  !   .  summary:     (28) merge zero known
+  !   !  date:        Thu Jan 01 00:00:28 1970 +0000
+  !   !  summary:     (28) merge zero known
   !  /
   o !    changeset:   26:7f25b6c2f0b9
   !\ \   parent:      18:1aa84d96232a
   ! ! !  parent:      25:91da8ed57247
   ! ! !  user:        test
-  ! ! .  date:        Thu Jan 01 00:00:26 1970 +0000
-  ! ! .  summary:     (26) merge one known; far right
-  ! ! .
+  ! ! !  date:        Thu Jan 01 00:00:26 1970 +0000
+  ! ! !  summary:     (26) merge one known; far right
+  ! ! !
   ! o !  changeset:   25:91da8ed57247
   ! !\!  parent:      21:d42a756af44d
   ! ! !  parent:      24:a9c19a3d96b7
   ! ! !  user:        test
-  ! ! .  date:        Thu Jan 01 00:00:25 1970 +0000
-  ! ! .  summary:     (25) merge one known; far left
-  ! ! .
+  ! ! !  date:        Thu Jan 01 00:00:25 1970 +0000
+  ! ! !  summary:     (25) merge one known; far left
+  ! ! !
   ! o !    changeset:   24:a9c19a3d96b7
   ! !\ \   parent:      0:e6eb3150255d
   ! ! ~ !  parent:      23:a01cddf0766d
   ! !   !  user:        test
-  ! !   .  date:        Thu Jan 01 00:00:24 1970 +0000
-  ! !   .  summary:     (24) merge one known; immediate right
+  ! !   !  date:        Thu Jan 01 00:00:24 1970 +0000
+  ! !   !  summary:     (24) merge one known; immediate right
   ! !  /
   ! o !    changeset:   23:a01cddf0766d
   ! !\ \   parent:      1:6db2ef61d156
   ! ! ~ !  parent:      22:e0d9cccacb5d
   ! !   !  user:        test
-  ! !   .  date:        Thu Jan 01 00:00:23 1970 +0000
-  ! !   .  summary:     (23) merge one known; immediate left
+  ! !   !  date:        Thu Jan 01 00:00:23 1970 +0000
+  ! !   !  summary:     (23) merge one known; immediate left
   ! !  /
   ! o !  changeset:   22:e0d9cccacb5d
   !/!/   parent:      18:1aa84d96232a
   ! !    parent:      21:d42a756af44d
   ! !    user:        test
-  ! .    date:        Thu Jan 01 00:00:22 1970 +0000
-  ! .    summary:     (22) merge two known; one far left, one far right
-  ! .
+  ! !    date:        Thu Jan 01 00:00:22 1970 +0000
+  ! !    summary:     (22) merge two known; one far left, one far right
+  ! !
   ! o    changeset:   21:d42a756af44d
   ! !\   parent:      19:31ddc2c1573b
   ! ! !  parent:      20:d30ed6450e32
@@ -3178,59 +3178,59 @@ 
   o !  changeset:   31:621d83e11f67
   !\!  parent:      21:d42a756af44d
   ! !  parent:      30:6e11cd4b648f
-  ! .  user:        test
-  ! .  date:        Thu Jan 01 00:00:31 1970 +0000
-  ! .  summary:     (31) expand
-  ! .
+  ! !  user:        test
+  ! !  date:        Thu Jan 01 00:00:31 1970 +0000
+  ! !  summary:     (31) expand
+  ! !
   o !    changeset:   30:6e11cd4b648f
   !\ \   parent:      28:44ecd0b9ae99
   ! ~ !  parent:      29:cd9bb2be7593
-  !   .  user:        test
-  !   .  date:        Thu Jan 01 00:00:30 1970 +0000
-  !   .  summary:     (30) expand
+  !   !  user:        test
+  !   !  date:        Thu Jan 01 00:00:30 1970 +0000
+  !   !  summary:     (30) expand
   !  /
   o !    changeset:   28:44ecd0b9ae99
   !\ \   parent:      1:6db2ef61d156
   ! ~ !  parent:      26:7f25b6c2f0b9
-  !   .  user:        test
-  !   .  date:        Thu Jan 01 00:00:28 1970 +0000
-  !   .  summary:     (28) merge zero known
+  !   !  user:        test
+  !   !  date:        Thu Jan 01 00:00:28 1970 +0000
+  !   !  summary:     (28) merge zero known
   !  /
   o !    changeset:   26:7f25b6c2f0b9
   !\ \   parent:      18:1aa84d96232a
   ! ! !  parent:      25:91da8ed57247
-  ! ! .  user:        test
-  ! ! .  date:        Thu Jan 01 00:00:26 1970 +0000
-  ! ! .  summary:     (26) merge one known; far right
-  ! ! .
+  ! ! !  user:        test
+  ! ! !  date:        Thu Jan 01 00:00:26 1970 +0000
+  ! ! !  summary:     (26) merge one known; far right
+  ! ! !
   ! o !  changeset:   25:91da8ed57247
   ! !\!  parent:      21:d42a756af44d
   ! ! !  parent:      24:a9c19a3d96b7
-  ! ! .  user:        test
-  ! ! .  date:        Thu Jan 01 00:00:25 1970 +0000
-  ! ! .  summary:     (25) merge one known; far left
-  ! ! .
+  ! ! !  user:        test
+  ! ! !  date:        Thu Jan 01 00:00:25 1970 +0000
+  ! ! !  summary:     (25) merge one known; far left
+  ! ! !
   ! o !    changeset:   24:a9c19a3d96b7
   ! !\ \   parent:      0:e6eb3150255d
   ! ! ~ !  parent:      23:a01cddf0766d
-  ! !   .  user:        test
-  ! !   .  date:        Thu Jan 01 00:00:24 1970 +0000
-  ! !   .  summary:     (24) merge one known; immediate right
+  ! !   !  user:        test
+  ! !   !  date:        Thu Jan 01 00:00:24 1970 +0000
+  ! !   !  summary:     (24) merge one known; immediate right
   ! !  /
   ! o !    changeset:   23:a01cddf0766d
   ! !\ \   parent:      1:6db2ef61d156
   ! ! ~ !  parent:      22:e0d9cccacb5d
-  ! !   .  user:        test
-  ! !   .  date:        Thu Jan 01 00:00:23 1970 +0000
-  ! !   .  summary:     (23) merge one known; immediate left
+  ! !   !  user:        test
+  ! !   !  date:        Thu Jan 01 00:00:23 1970 +0000
+  ! !   !  summary:     (23) merge one known; immediate left
   ! !  /
   ! o !  changeset:   22:e0d9cccacb5d
   !/!/   parent:      18:1aa84d96232a
   ! !    parent:      21:d42a756af44d
-  ! .    user:        test
-  ! .    date:        Thu Jan 01 00:00:22 1970 +0000
-  ! .    summary:     (22) merge two known; one far left, one far right
-  ! .
+  ! !    user:        test
+  ! !    date:        Thu Jan 01 00:00:22 1970 +0000
+  ! !    summary:     (22) merge two known; one far left, one far right
+  ! !
   ! o    changeset:   21:d42a756af44d
   ! !\   parent:      19:31ddc2c1573b
   ! ! !  parent:      20:d30ed6450e32