D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-22 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf56a30b844aa: rebase: use fm.formatlist() and 
fm.formatdict() to support user template (authored by pulkit, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D1293?vs=3725=3767#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1293?vs=3725=3767

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-templates.t

CHANGE DETAILS

diff --git a/tests/test-rebase-templates.t b/tests/test-rebase-templates.t
--- a/tests/test-rebase-templates.t
+++ b/tests/test-rebase-templates.t
@@ -54,5 +54,4 @@
   
 
   $ hg rebase -s 6 -d 4 -q -T "{nodechanges % '{oldnode}:{newnodes % ' {node} 
'}'}"
-  d9d6773efc831c274eace04bc13e8e6412517139: 
f48cd65c6dc3d2acb55da54402a5b029546e546f  (no-eol) (false !)
-  d9d6773efc831c274eace04bc13e8e6412517139 (no-eol)
+  d9d6773efc831c274eace04bc13e8e6412517139: 
f48cd65c6dc3d2acb55da54402a5b029546e546f  (no-eol)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -21,7 +21,6 @@
 
 from mercurial.i18n import _
 from mercurial.node import (
-hex,
 nullid,
 nullrev,
 short,
@@ -1563,8 +1562,12 @@
 replacements[oldnode] = succs
 scmutil.cleanupnodes(repo, replacements, 'rebase', moves)
 if fm:
-nodechanges = {hex(oldn): [hex(n) for n in newn]
-   for oldn, newn in replacements.iteritems()}
+hf = fm.hexfunc
+fl = fm.formatlist
+fd = fm.formatdict
+nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], name='node')
+  for oldn, newn in replacements.iteritems()},
+ key="oldnode", value="newnodes")
 fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **opts):



To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-22 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Queued the series, many thanks.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-21 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3725.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1293?vs=3705=3725

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-templates.t

CHANGE DETAILS

diff --git a/tests/test-rebase-templates.t b/tests/test-rebase-templates.t
--- a/tests/test-rebase-templates.t
+++ b/tests/test-rebase-templates.t
@@ -54,5 +54,4 @@
   
 
   $ hg rebase -s 6 -d 4 -q -T "{nodechanges % '{oldnode}:{newnodes % ' {node} 
'}'}"
-  d9d6773efc831c274eace04bc13e8e6412517139: 
f48cd65c6dc3d2acb55da54402a5b029546e546f  (no-eol) (false !)
-  d9d6773efc831c274eace04bc13e8e6412517139 (no-eol)
+  d9d6773efc831c274eace04bc13e8e6412517139: 
f48cd65c6dc3d2acb55da54402a5b029546e546f  (no-eol)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -21,7 +21,6 @@
 
 from mercurial.i18n import _
 from mercurial.node import (
-hex,
 nullid,
 nullrev,
 short,
@@ -1563,8 +1562,12 @@
 replacements[oldnode] = succs
 scmutil.cleanupnodes(repo, replacements, 'rebase', moves)
 if fm:
-nodechanges = {hex(oldn): [hex(n) for n in newn]
-   for oldn, newn in replacements.iteritems()}
+hf = fm.hexfunc
+fl = fm.formatlist
+fd = fm.formatdict
+nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], 'node')
+  for oldn, newn in replacements.iteritems()},
+  key="oldnode", value="newnodes")
 fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **opts):



To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-21 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > I am not sure whether that was what you wanted.
  
  It's getting closer, thanks. What I meant is `{key}` and `{value}` wouldn't 
be good
  keyword names because the they are actually an old node and a list of new 
nodes
  respectively.
  
  I think a template should be expressed something like this:
  
`{oldnode}: {newnodes % '{node} '}`

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-20 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D1293#22323, @yuja wrote:
  
  > Something like this:
  >
  > -T '{nodechanges % ": {value % ...}"}'
  
  
  I have added a test. I am not sure whether that was what you wanted.
  
  (Fun fact: I was trying various permutations of `{nodechanges % ":{value % 
...}"}` and gave up last night. When I quoted your comment to say I am unable 
to come up with a case, I saw you had `{key}` in your comment too which was 
invisible. )

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-20 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3705.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1293?vs=3670=3705

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-templates.t

CHANGE DETAILS

diff --git a/tests/test-rebase-templates.t b/tests/test-rebase-templates.t
--- a/tests/test-rebase-templates.t
+++ b/tests/test-rebase-templates.t
@@ -54,5 +54,4 @@
   
 
   $ hg rebase -s 6 -d 4 -q -T "{nodechanges % '{key}:{value}'}"
-  
d9d6773efc831c274eace04bc13e8e6412517139:f48cd65c6dc3d2acb55da54402a5b029546e546f
 (no-eol) (false !)
-  d9d6773efc831c274eace04bc13e8e6412517139 (no-eol) (true !)
+  
d9d6773efc831c274eace04bc13e8e6412517139:f48cd65c6dc3d2acb55da54402a5b029546e546f
 (no-eol)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -21,7 +21,6 @@
 
 from mercurial.i18n import _
 from mercurial.node import (
-hex,
 nullid,
 nullrev,
 short,
@@ -1563,8 +1562,11 @@
 replacements[oldnode] = succs
 scmutil.cleanupnodes(repo, replacements, 'rebase', moves)
 if fm:
-nodechanges = {hex(oldn): [hex(n) for n in newn]
-   for oldn, newn in replacements.iteritems()}
+hf = fm.hexfunc
+fl = fm.formatlist
+fd = fm.formatdict
+nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], 'succ')
+  for oldn, newn in replacements.iteritems()})
 fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **opts):



To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-20 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3670.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1293?vs=3229=3670

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-templates.t

CHANGE DETAILS

diff --git a/tests/test-rebase-templates.t b/tests/test-rebase-templates.t
--- a/tests/test-rebase-templates.t
+++ b/tests/test-rebase-templates.t
@@ -54,4 +54,4 @@
   
 
   $ hg rebase -s 6 -d 4 -q -T "{nodechanges % '{key}:{value}'}"
-  d9d6773efc831c274eace04bc13e8e6412517139 (no-eol)
+  
d9d6773efc831c274eace04bc13e8e6412517139:f48cd65c6dc3d2acb55da54402a5b029546e546f
 (no-eol)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -21,7 +21,6 @@
 
 from mercurial.i18n import _
 from mercurial.node import (
-hex,
 nullid,
 nullrev,
 short,
@@ -1563,8 +1562,11 @@
 replacements[oldnode] = succs
 scmutil.cleanupnodes(repo, replacements, 'rebase', moves)
 if fm:
-nodechanges = {hex(oldn): [hex(n) for n in newn]
-   for oldn, newn in replacements.iteritems()}
+hf = fm.hexfunc
+fl = fm.formatlist
+fd = fm.formatdict
+nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], 'succ')
+  for oldn, newn in replacements.iteritems()})
 fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **opts):



To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-08 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D1293#21761, @yuja wrote:
  
  > Can you add a test that should be fixed by this patch?
  >  Perhaps that will show we'll probably want to set the name of dict item 
pair
  >  other than the default 'key'/'value'.
  
  
  Sorry but I am unable to understand the test part. Can you point me to an 
example?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-04 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  Can you add a test that should be fixed by this patch?
  Perhaps that will show we'll probably want to set the name of dict item pair
  other than the default 'key'/'value'.

INLINE COMMENTS

> rebase.py:1550
> +fd = fm.formatdict
> +nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], 'succs')
> +  for oldn, newn in replacements.iteritems()})

The name argument is for each item, not for the list. Perhaps,
it should be name='node' (or name ='succ').

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

2017-11-02 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Thanks to Yuya for suggesting this in https://phab.mercurial-scm.org/D1173.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1293

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -21,7 +21,6 @@
 
 from mercurial.i18n import _
 from mercurial.node import (
-hex,
 nullid,
 nullrev,
 short,
@@ -1545,8 +1544,11 @@
 replacements[oldnode] = succs
 scmutil.cleanupnodes(repo, replacements, 'rebase', moves)
 if fm:
-nodechanges = {hex(oldn): [hex(n) for n in newn]
-   for oldn, newn in replacements.iteritems()}
+hf = fm.hexfunc
+fl = fm.formatlist
+fd = fm.formatdict
+nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], 'succs')
+  for oldn, newn in replacements.iteritems()})
 fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **opts):



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel