D450: filemerge: add wctx to all internal tools

2017-09-07 Thread phillco (Phil Cohen)
phillco abandoned this revision.
phillco added a subscriber: martinvonz.
phillco added a comment.


  No longer needed thanks to @martinvonz's careful eye.

REPOSITORY
  rHG Mercurial

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

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


D450: filemerge: add wctx to all internal tools

2017-09-04 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1607.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D450?vs=1299=1607

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

AFFECTED FILES
  contrib/phabricator.py
  mercurial/filemerge.py
  mercurial/tagmerge.py

CHANGE DETAILS

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -216,7 +216,7 @@
 # whole list of lr nodes
 return lrnodes + hrnodes[commonidx:]
 
-def merge(repo, fcd, fco, fca):
+def merge(repo, wctx, fcd, fco, fca):
 '''
 Merge the tags of two revisions, taking into account the base tags
 Try to minimize the diff between the merged tags and the first parent tags
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -238,7 +238,7 @@
 util.writefile(file, newdata)
 
 @internaltool('prompt', nomerge)
-def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iprompt(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Asks the user which of the local `p1()` or the other `p2()` version to
 keep as the merged version."""
 ui = repo.ui
@@ -263,26 +263,26 @@
 choice = ['local', 'other', 'unresolved'][index]
 
 if choice == 'other':
-return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'local':
-return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ilocal(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'unresolved':
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 except error.ResponseExpected:
 ui.write("\n")
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 
 @internaltool('local', nomerge)
-def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ilocal(repo, wtcx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the local `p1()` version of files as the merged version."""
 return 0, fcd.isabsent()
 
 @internaltool('other', nomerge)
-def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the other `p2()` version of files as the merged version."""
 if fco.isabsent():
 # local changed, remote deleted -- 'deleted' picked
@@ -294,7 +294,7 @@
 return 0, deleted
 
 @internaltool('fail', nomerge)
-def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """
 Rather than attempting to merge files that were modified on both
 branches, it marks them as unresolved. The resolve command must be
@@ -362,7 +362,8 @@
 return False
 return True
 
-def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
+def _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files, labels,
+   mode):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
@@ -377,32 +378,35 @@
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _iunion(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will use both left and right sides for conflict regions.
 No markers are inserted."""
-return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   files, labels, 'union')
 
 @internaltool('merge', fullmerge,
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _imerge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
 the partially merged file. Markers will have two sections, one for each 
side
 of merge."""
-return 

D450: filemerge: add wctx to all internal tools

2017-08-25 Thread phillco (Phil Cohen)
phillco planned changes to this revision.
phillco added a comment.


  Will reintroduce later, closer to changes further up the stack.

REPOSITORY
  rHG Mercurial

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

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


D450: filemerge: add wctx to all internal tools

2017-08-25 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1299.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D450?vs=1238=1299

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

AFFECTED FILES
  contrib/phabricator.py
  mercurial/filemerge.py
  mercurial/tagmerge.py

CHANGE DETAILS

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -216,7 +216,7 @@
 # whole list of lr nodes
 return lrnodes + hrnodes[commonidx:]
 
-def merge(repo, fcd, fco, fca):
+def merge(repo, wctx, fcd, fco, fca):
 '''
 Merge the tags of two revisions, taking into account the base tags
 Try to minimize the diff between the merged tags and the first parent tags
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -238,7 +238,7 @@
 util.writefile(file, newdata)
 
 @internaltool('prompt', nomerge)
-def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iprompt(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Asks the user which of the local `p1()` or the other `p2()` version to
 keep as the merged version."""
 ui = repo.ui
@@ -263,26 +263,26 @@
 choice = ['local', 'other', 'unresolved'][index]
 
 if choice == 'other':
-return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'local':
-return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ilocal(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'unresolved':
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 except error.ResponseExpected:
 ui.write("\n")
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 
 @internaltool('local', nomerge)
-def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ilocal(repo, wtcx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the local `p1()` version of files as the merged version."""
 return 0, fcd.isabsent()
 
 @internaltool('other', nomerge)
-def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the other `p2()` version of files as the merged version."""
 if fco.isabsent():
 # local changed, remote deleted -- 'deleted' picked
@@ -294,7 +294,7 @@
 return 0, deleted
 
 @internaltool('fail', nomerge)
-def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """
 Rather than attempting to merge files that were modified on both
 branches, it marks them as unresolved. The resolve command must be
@@ -362,7 +362,8 @@
 return False
 return True
 
-def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
+def _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files, labels,
+   mode):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
@@ -380,32 +381,35 @@
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _iunion(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will use both left and right sides for conflict regions.
 No markers are inserted."""
-return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   files, labels, 'union')
 
 @internaltool('merge', fullmerge,
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _imerge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
 the partially merged file. Markers will have two sections, one for each 
side
 of merge."""
-return 

D450: filemerge: add wctx to all internal tools

2017-08-23 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1238.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D450?vs=1237=1238

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

AFFECTED FILES
  mercurial/filemerge.py
  mercurial/tagmerge.py

CHANGE DETAILS

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -216,7 +216,7 @@
 # whole list of lr nodes
 return lrnodes + hrnodes[commonidx:]
 
-def merge(repo, fcd, fco, fca):
+def merge(repo, wctx, fcd, fco, fca):
 '''
 Merge the tags of two revisions, taking into account the base tags
 Try to minimize the diff between the merged tags and the first parent tags
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -238,7 +238,7 @@
 util.writefile(file, newdata)
 
 @internaltool('prompt', nomerge)
-def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iprompt(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Asks the user which of the local `p1()` or the other `p2()` version to
 keep as the merged version."""
 ui = repo.ui
@@ -263,26 +263,26 @@
 choice = ['local', 'other', 'unresolved'][index]
 
 if choice == 'other':
-return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'local':
-return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ilocal(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'unresolved':
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 except error.ResponseExpected:
 ui.write("\n")
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 
 @internaltool('local', nomerge)
-def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ilocal(repo, wtcx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the local `p1()` version of files as the merged version."""
 return 0, fcd.isabsent()
 
 @internaltool('other', nomerge)
-def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the other `p2()` version of files as the merged version."""
 if fco.isabsent():
 # local changed, remote deleted -- 'deleted' picked
@@ -294,7 +294,7 @@
 return 0, deleted
 
 @internaltool('fail', nomerge)
-def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """
 Rather than attempting to merge files that were modified on both
 branches, it marks them as unresolved. The resolve command must be
@@ -362,7 +362,8 @@
 return False
 return True
 
-def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
+def _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files, labels,
+   mode):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
@@ -380,32 +381,35 @@
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _iunion(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will use both left and right sides for conflict regions.
 No markers are inserted."""
-return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   files, labels, 'union')
 
 @internaltool('merge', fullmerge,
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _imerge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
 the partially merged file. Markers will have two sections, one for each 
side
 of merge."""
-return _merge(repo, mynode, 

D450: filemerge: add wctx to all internal tools

2017-08-23 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1237.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D450?vs=1234=1237

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

AFFECTED FILES
  mercurial/filemerge.py
  mercurial/tagmerge.py

CHANGE DETAILS

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -216,7 +216,7 @@
 # whole list of lr nodes
 return lrnodes + hrnodes[commonidx:]
 
-def merge(repo, fcd, fco, fca):
+def merge(repo, wctx, fcd, fco, fca):
 '''
 Merge the tags of two revisions, taking into account the base tags
 Try to minimize the diff between the merged tags and the first parent tags
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -238,7 +238,7 @@
 util.writefile(file, newdata)
 
 @internaltool('prompt', nomerge)
-def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iprompt(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Asks the user which of the local `p1()` or the other `p2()` version to
 keep as the merged version."""
 ui = repo.ui
@@ -263,26 +263,26 @@
 choice = ['local', 'other', 'unresolved'][index]
 
 if choice == 'other':
-return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'local':
-return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ilocal(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'unresolved':
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 except error.ResponseExpected:
 ui.write("\n")
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 
 @internaltool('local', nomerge)
-def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ilocal(repo, wtcx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the local `p1()` version of files as the merged version."""
 return 0, fcd.isabsent()
 
 @internaltool('other', nomerge)
-def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the other `p2()` version of files as the merged version."""
 if fco.isabsent():
 # local changed, remote deleted -- 'deleted' picked
@@ -294,7 +294,7 @@
 return 0, deleted
 
 @internaltool('fail', nomerge)
-def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """
 Rather than attempting to merge files that were modified on both
 branches, it marks them as unresolved. The resolve command must be
@@ -362,7 +362,8 @@
 return False
 return True
 
-def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
+def _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files, labels,
+   mode):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
@@ -380,32 +381,35 @@
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _iunion(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will use both left and right sides for conflict regions.
 No markers are inserted."""
-return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   files, labels, 'union')
 
 @internaltool('merge', fullmerge,
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _imerge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
 the partially merged file. Markers will have two sections, one for each 
side
 of merge."""
-return _merge(repo, mynode, 

D450: filemerge: add wctx to all internal tools

2017-08-23 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1234.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D450?vs=1211=1234

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

AFFECTED FILES
  mercurial/filemerge.py
  mercurial/tagmerge.py

CHANGE DETAILS

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -216,7 +216,7 @@
 # whole list of lr nodes
 return lrnodes + hrnodes[commonidx:]
 
-def merge(repo, fcd, fco, fca):
+def merge(repo, wctx, fcd, fco, fca):
 '''
 Merge the tags of two revisions, taking into account the base tags
 Try to minimize the diff between the merged tags and the first parent tags
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -238,7 +238,7 @@
 util.writefile(file, newdata)
 
 @internaltool('prompt', nomerge)
-def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iprompt(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Asks the user which of the local `p1()` or the other `p2()` version to
 keep as the merged version."""
 ui = repo.ui
@@ -263,26 +263,26 @@
 choice = ['local', 'other', 'unresolved'][index]
 
 if choice == 'other':
-return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'local':
-return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ilocal(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'unresolved':
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 except error.ResponseExpected:
 ui.write("\n")
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 
 @internaltool('local', nomerge)
-def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ilocal(repo, wtcx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the local `p1()` version of files as the merged version."""
 return 0, fcd.isabsent()
 
 @internaltool('other', nomerge)
-def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the other `p2()` version of files as the merged version."""
 if fco.isabsent():
 # local changed, remote deleted -- 'deleted' picked
@@ -294,7 +294,7 @@
 return 0, deleted
 
 @internaltool('fail', nomerge)
-def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """
 Rather than attempting to merge files that were modified on both
 branches, it marks them as unresolved. The resolve command must be
@@ -362,7 +362,8 @@
 return False
 return True
 
-def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
+def _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files, labels,
+   mode):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
@@ -380,32 +381,35 @@
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _iunion(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will use both left and right sides for conflict regions.
 No markers are inserted."""
-return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   files, labels, 'union')
 
 @internaltool('merge', fullmerge,
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _imerge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
 the partially merged file. Markers will have two sections, one for each 
side
 of merge."""
-return _merge(repo, mynode, 

D450: filemerge: add wctx to all internal tools

2017-08-23 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1211.
phillco edited the summary of this revision.
phillco retitled this revision from "filemerge: pass `wctx` to all internal 
merge tool functions" to "filemerge: add wctx to all internal tools".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D450?vs=1084=1211

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

AFFECTED FILES
  contrib/phabricator.py
  mercurial/filemerge.py
  mercurial/tagmerge.py

CHANGE DETAILS

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -216,7 +216,7 @@
 # whole list of lr nodes
 return lrnodes + hrnodes[commonidx:]
 
-def merge(repo, fcd, fco, fca):
+def merge(repo, wctx, fcd, fco, fca):
 '''
 Merge the tags of two revisions, taking into account the base tags
 Try to minimize the diff between the merged tags and the first parent tags
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -250,7 +250,7 @@
 util.writefile(file, newdata)
 
 @internaltool('prompt', nomerge)
-def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iprompt(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Asks the user which of the local `p1()` or the other `p2()` version to
 keep as the merged version."""
 ui = repo.ui
@@ -275,26 +275,26 @@
 choice = ['local', 'other', 'unresolved'][index]
 
 if choice == 'other':
-return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'local':
-return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ilocal(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
labels)
 elif choice == 'unresolved':
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 except error.ResponseExpected:
 ui.write("\n")
-return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   labels)
 
 @internaltool('local', nomerge)
-def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ilocal(repo, wtcx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the local `p1()` version of files as the merged version."""
 return 0, fcd.isabsent()
 
 @internaltool('other', nomerge)
-def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _iother(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """Uses the other `p2()` version of files as the merged version."""
 if fco.isabsent():
 # local changed, remote deleted -- 'deleted' picked
@@ -306,7 +306,7 @@
 return 0, deleted
 
 @internaltool('fail', nomerge)
-def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
+def _ifail(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, labels=None):
 """
 Rather than attempting to merge files that were modified on both
 branches, it marks them as unresolved. The resolve command must be
@@ -374,7 +374,8 @@
 return False
 return True
 
-def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
+def _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files, labels,
+   mode):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will fail if there are any conflicts and leave markers in
@@ -392,32 +393,35 @@
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _iunion(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for merging
 files. It will use both left and right sides for conflict regions.
 No markers are inserted."""
-return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
+return _merge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf,
   files, labels, 'union')
 
 @internaltool('merge', fullmerge,
   _("warning: conflicts while merging %s! "
 "(edit, then use 'hg resolve --mark')\n"),
   precheck=_mergecheck)
-def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
+def _imerge(repo, wctx, mynode, orig, fcd, fco, fca, toolconf, files,
+labels=None):
 """
 Uses the internal non-interactive simple merge algorithm for