D372: simplemerge: add optional context parameters to simplemerge

2017-08-19 Thread phillco (Phil Cohen)
phillco added inline comments.

INLINE COMMENTS

> martinvonz wrote in simplemerge.py:412
> Seems unfortunate to have both files and contexts. This is what you mentioned 
> today you will replace by use of "arbitraryfilectx"?

They get taken out in https://phab.mercurial-scm.org/D381; they have to 
co-exist briefly in order to ensure each step of this series can be applied 
cleanly.

REPOSITORY
  rHG Mercurial

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

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


D372: simplemerge: add optional context parameters to simplemerge

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

INLINE COMMENTS

> simplemerge.py:412
> +def simplemerge(ui, localfile, basefile, otherfile,
> +localctx=None, basectx=None, otherctx=None, repo=None, 
> **opts):
>  def readfile(filename):

Seems unfortunate to have both files and contexts. This is what you mentioned 
today you will replace by use of "arbitraryfilectx"?

REPOSITORY
  rHG Mercurial

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

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


D372: simplemerge: add optional context parameters to simplemerge

2017-08-15 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb3571dc0e6b8: simplemerge: add optional context parameters 
to simplemerge (authored by phillco).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D372?vs=853=954

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

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
@@ -408,7 +408,8 @@
 raise error.Abort(msg)
 return text
 
-def simplemerge(ui, local, base, other, **opts):
+def simplemerge(ui, localfile, basefile, otherfile,
+localctx=None, basectx=None, otherctx=None, repo=None, **opts):
 def readfile(filename):
 f = open(filename, "rb")
 text = f.read()
@@ -421,8 +422,8 @@
 name_b = None
 name_base = None
 else:
-name_a = local
-name_b = other
+name_a = localfile
+name_b = otherfile
 name_base = None
 labels = opts.get('label', [])
 if len(labels) > 0:
@@ -435,16 +436,16 @@
 raise error.Abort(_("can only specify three labels."))
 
 try:
-localtext = readfile(local)
-basetext = readfile(base)
-othertext = readfile(other)
+localtext = readfile(localfile)
+basetext = readfile(basefile)
+othertext = readfile(otherfile)
 except error.Abort:
 return 1
 
-local = os.path.realpath(local)
+localfile = os.path.realpath(localfile)
 if not opts.get('print'):
-opener = vfsmod.vfs(os.path.dirname(local))
-out = opener(os.path.basename(local), "w", atomictemp=True)
+opener = vfsmod.vfs(os.path.dirname(localfile))
+out = opener(os.path.basename(localfile), "w", atomictemp=True)
 else:
 out = ui.fout
 



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


D372: simplemerge: add optional context parameters to simplemerge

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
  Rename the existing parameters for clarity.
  
  These will, in subsequent patches, allow callers to redirect reads (of the
  three sides of the merge) and writes (of the result) to the given contexts,
  instead of using the filesystem.
  
  While in most cases, the writes will go to a workingfilectx, this opens the
  door for it to be a memfilectx in the case of an in-memory merge.
  
  Repo will be necessary in a subsequent comit.

REPOSITORY
  rHG Mercurial

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

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
@@ -408,7 +408,8 @@
 raise error.Abort(msg)
 return text
 
-def simplemerge(ui, local, base, other, **opts):
+def simplemerge(ui, localfile, basefile, otherfile,
+localctx=None, basectx=None, otherctx=None, repo=None, **opts):
 def readfile(filename):
 f = open(filename, "rb")
 text = f.read()
@@ -421,8 +422,8 @@
 name_b = None
 name_base = None
 else:
-name_a = local
-name_b = other
+name_a = localfile
+name_b = otherfile
 name_base = None
 labels = opts.get('label', [])
 if len(labels) > 0:
@@ -435,16 +436,16 @@
 raise error.Abort(_("can only specify three labels."))
 
 try:
-localtext = readfile(local)
-basetext = readfile(base)
-othertext = readfile(other)
+localtext = readfile(localfile)
+basetext = readfile(basefile)
+othertext = readfile(otherfile)
 except error.Abort:
 return 1
 
-local = os.path.realpath(local)
+localfile = os.path.realpath(localfile)
 if not opts.get('print'):
-opener = vfsmod.vfs(os.path.dirname(local))
-out = opener(os.path.basename(local), "w", atomictemp=True)
+opener = vfsmod.vfs(os.path.dirname(localfile))
+out = opener(os.path.basename(localfile), "w", atomictemp=True)
 else:
 out = ui.fout
 



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