D380: simplemerge: stop reading from, and writing to, files

2017-08-25 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG61b267a99fea: simplemerge: stop reading from, and writing 
to, files (authored by phillco).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D380?vs=1040=1285

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

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -18,15 +18,12 @@
 
 from __future__ import absolute_import
 
-import os
-
 from .i18n import _
 from . import (
 error,
 mdiff,
 pycompat,
 util,
-vfs as vfsmod,
 )
 
 class CantReprocessAndShowBase(Exception):
@@ -428,13 +425,8 @@
 
 {local|base|other}ctx are optional. If passed, they (local/base/other) will
 be read from and the merge result written to (local). You should pass
-explicit labels in this mode since the default is to use the file paths."""
-def readfile(filename):
-f = open(filename, "rb")
-text = f.read()
-f.close()
-return _verifytext(text, filename, ui, opts)
-
+explicit labels in this mode since the default is to use the file paths.
+"""
 def readctx(ctx):
 if not ctx:
 return None
@@ -466,20 +458,16 @@
 opts.get('label', []))
 
 try:
-localtext = readctx(localctx) if localctx else readfile(localfile)
-basetext = readctx(basectx) if basectx else readfile(basefile)
-othertext = readctx(otherctx) if otherctx else readfile(otherfile)
+localtext = readctx(localctx)
+basetext = readctx(basectx)
+othertext = readctx(otherctx)
 except error.Abort:
 return 1
 
 if opts.get('print'):
 out = ui.fout
-elif localctx:
+else:
 out = ctxwriter(localctx)
-else:
-localfile = os.path.realpath(localfile)
-opener = vfsmod.vfs(os.path.dirname(localfile))
-out = opener(os.path.basename(localfile), "w", atomictemp=True)
 
 m3 = Merge3Text(basetext, localtext, othertext)
 extrakwargs = {



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


D380: simplemerge: stop reading from, and writing to, files

2017-08-17 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 1040.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D380?vs=861=1040

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

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -18,15 +18,12 @@
 
 from __future__ import absolute_import
 
-import os
-
 from .i18n import _
 from . import (
 error,
 mdiff,
 pycompat,
 util,
-vfs as vfsmod,
 )
 
 class CantReprocessAndShowBase(Exception):
@@ -428,13 +425,8 @@
 
 {local|base|other}ctx are optional. If passed, they (local/base/other) will
 be read from and the merge result written to (local). You should pass
-explicit labels in this mode since the default is to use the file paths."""
-def readfile(filename):
-f = open(filename, "rb")
-text = f.read()
-f.close()
-return _verifytext(text, filename, ui, opts)
-
+explicit labels in this mode since the default is to use the file paths.
+"""
 def readctx(ctx):
 if not ctx:
 return None
@@ -466,20 +458,16 @@
 opts.get('label', []))
 
 try:
-localtext = readctx(localctx) if localctx else readfile(localfile)
-basetext = readctx(basectx) if basectx else readfile(basefile)
-othertext = readctx(otherctx) if otherctx else readfile(otherfile)
+localtext = readctx(localctx)
+basetext = readctx(basectx)
+othertext = readctx(otherctx)
 except error.Abort:
 return 1
 
 if opts.get('print'):
 out = ui.fout
-elif localctx:
+else:
 out = ctxwriter(localctx)
-else:
-localfile = os.path.realpath(localfile)
-opener = vfsmod.vfs(os.path.dirname(localfile))
-out = opener(os.path.basename(localfile), "w", atomictemp=True)
 
 m3 = Merge3Text(basetext, localtext, othertext)
 extrakwargs = {



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


D380: simplemerge: stop reading from, and writing to, files

2017-08-14 Thread phillco (Phil Cohen)
phillco created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We now use contexts first for everything and also pass them everywhere.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -18,15 +18,12 @@
 
 from __future__ import absolute_import
 
-import os
-
 from .i18n import _
 from . import (
 error,
 mdiff,
 pycompat,
 util,
-vfs as vfsmod,
 )
 
 class CantReprocessAndShowBase(Exception):
@@ -434,12 +431,6 @@
 filtereddata should only be True if the data() in your context returns
 decoded data.
 """
-def readfile(filename):
-f = open(filename, "rb")
-text = f.read()
-f.close()
-return _verifytext(text, filename, ui, opts)
-
 def readctx(ctx):
 if not ctx:
 return None
@@ -476,20 +467,16 @@
 opts.get('label', []))
 
 try:
-localtext = readctx(localctx) if localctx else readfile(localfile)
-basetext = readctx(basectx) if basectx else readfile(basefile)
-othertext = readctx(otherctx) if otherctx else readfile(otherfile)
+localtext = readctx(localctx)
+basetext = readctx(basectx)
+othertext = readctx(otherctx)
 except error.Abort:
 return 1
 
 if opts.get('print'):
 out = ui.fout
-elif localctx:
+else:
 out = ctxwriter(localctx)
-else:
-localfile = os.path.realpath(localfile)
-opener = vfsmod.vfs(os.path.dirname(localfile))
-out = opener(os.path.basename(localfile), "w", atomictemp=True)
 
 m3 = Merge3Text(basetext, localtext, othertext)
 extrakwargs = {



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