D401: filemerge: add `_workingpath`

2017-09-05 Thread singhsrb (Saurabh Singh)
singhsrb updated this revision to Diff 1627.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1513&id=1627

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -470,8 +470,7 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, unused, unused, unused = files
-
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -494,7 +493,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -597,7 +597,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -705,7 +705,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -718,9 +718,9 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
-a, unused, unused, back = files
+unused, unused, unused, back = files
 
 if not r and (_toolbool(ui, tool, "checkconflicts") or
   'conflicts' in _toollist(ui, tool, "check")):
@@ -738,17 +738,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

2017-08-31 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7558917f291e: filemerge: add `_workingpath` (authored by 
phillco).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D401?vs=1503&id=1513#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1503&id=1513

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -470,8 +470,7 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, unused, unused, unused = files
-
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -494,7 +493,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -597,7 +597,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -705,7 +705,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -718,9 +718,9 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
-a, unused, unused, back = files
+unused, unused, unused, back = files
 
 if not r and (_toolbool(ui, tool, "checkconflicts") or
   'conflicts' in _toollist(ui, tool, "check")):
@@ -738,17 +738,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

2017-08-31 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1503.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1488&id=1503

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -471,8 +471,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -495,7 +495,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -598,7 +599,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -706,7 +707,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -719,7 +720,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -739,17 +740,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

2017-08-31 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> phillco wrote in filemerge.py:724
> you're right. I'll make that change in the morning.

It's now past morning (in our timezone) :-) But don't worry, I'll fix this in 
flight.

REPOSITORY
  rHG Mercurial

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

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


D401: filemerge: add `_workingpath`

2017-08-31 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1488.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1481&id=1488

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -471,8 +471,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -495,7 +495,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -598,7 +599,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -706,7 +707,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -719,7 +720,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -739,17 +740,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

2017-08-31 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1481.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1456&id=1481

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -471,8 +471,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -495,7 +495,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -593,7 +594,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -701,7 +702,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -714,7 +715,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -734,17 +735,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

2017-08-31 Thread phillco (Phil Cohen)
phillco abandoned this revision.
phillco added inline comments.

INLINE COMMENTS

> martinvonz wrote in filemerge.py:724
> should "a" be renamed to "unused" here?

you're right. I'll make that change in the morning.

REPOSITORY
  rHG Mercurial

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

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


D401: filemerge: add `_workingpath`

2017-08-31 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> filemerge.py:724
>  fd = fcd.path()
>  a, unused, unused, back = files
>  

should "a" be renamed to "unused" here?

REPOSITORY
  rHG Mercurial

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

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


D401: filemerge: add `_workingpath`

2017-08-30 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1456.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1310&id=1456

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -471,8 +471,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -495,7 +495,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -597,7 +598,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -705,7 +706,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -718,7 +719,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -738,17 +739,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1306&id=1310

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -478,8 +478,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -503,7 +503,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -605,7 +606,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -714,7 +715,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -727,7 +728,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -747,17 +748,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca,
   labels=labels)



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


D401: filemerge: add `_workingpath`

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1223&id=1306

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -478,8 +478,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -503,7 +503,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -605,7 +606,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -714,7 +715,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -727,7 +728,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -747,20 +748,22 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
-return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca,
-  labels=labels)
+return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 
 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(False, repo, wctx, mynode, orig, fcd, fco, fca,



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


D401: filemerge: add `_workingpath`

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=911&id=1223

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -471,8 +471,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -495,7 +495,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -597,7 +598,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -705,7 +706,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -718,7 +719,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -738,17 +739,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

2017-08-14 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 911.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=910&id=911

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -483,8 +483,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -507,7 +507,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -609,7 +610,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -717,7 +718,7 @@
  toolconf, files, labels=labels)
 
 if needcheck:
-r = _check(r, ui, tool, fcd, files)
+r = _check(repo, r, ui, tool, fcd, files)
 
 if r:
 if onfailure:
@@ -730,7 +731,7 @@
 util.unlink(files[1])
 util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 a, unused, unused, back = files
 
@@ -750,17 +751,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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


D401: filemerge: add `_workingpath`

2017-08-14 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 910.
phillco edited the summary of this revision.
phillco retitled this revision from "filemerge: reduce creation of tempfiles 
until needed" to "filemerge: add `_workingpath`".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=908&id=910

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -483,8 +483,8 @@
 This implies permerge. Therefore, files aren't dumped, if premerge
 runs successfully. Use :forcedump to forcibly write files out.
 """
-a, b, c, back = files
-
+unused, unused, unused, unused = files
+a = _workingpath(repo, fcd)
 fd = fcd.path()
 
 util.copyfile(a, a + ".local")
@@ -507,7 +507,8 @@
 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
'for %s\n') % (tool, fcd.path()))
 return False, 1, None
-a, b, c, back = files
+unused, b, c, back = files
+a = _workingpath(repo, fcd)
 out = ""
 env = {'HG_FILE': fcd.path(),
'HG_MY_NODE': short(mynode),
@@ -609,7 +610,7 @@
 if fcd.isabsent():
 return None
 
-a = repo.wjoin(fcd.path())
+a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
@@ -750,17 +751,20 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(a, back):
+if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):
 r = 1
 
 if back is not None and _toolbool(ui, tool, "fixeol"):
-_matcheol(a, back)
+_matcheol(_workingpath(repo, fcd), back)
 
 return r
 
+def _workingpath(repo, ctx):
+return repo.wjoin(ctx.path())
+
 def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
 return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 



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