Patchwork D435: simplemerge: use `ctx.decoddeddata()` instead of `repo.wreaddata`

login
register
mail settings
Submitter phabricator
Date Aug. 25, 2017, 6:40 a.m.
Message ID <891bf6a18e563cfdd9eb2c3219049cc2@localhost.localdomain>
Download mbox | patch
Permalink /patch/23327/
State Not Applicable
Headers show

Comments

phabricator - Aug. 25, 2017, 6:40 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf39ba8237ed6: simplemerge: use `ctx.decoddeddata()` instead of `repo.wreaddata` (authored by phillco).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D435?vs=1037&id=1283

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

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS




To: phillco, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -438,15 +438,14 @@ 
     def readctx(ctx):
         if not ctx:
             return None
-        if not repo:
-            raise error.ProgrammingError('simplemerge: repo must be passed if '
-                                         'using contexts')
-        # `wwritedata` is used to get the post-filter data from `ctx` (i.e.,
-        # what would have been in the working copy). Since merges were run in
-        # the working copy, and thus used post-filter data, we do the same to
-        # maintain behavior.
-        return repo.wwritedata(ctx.path(),
-                               _verifytext(ctx.data(), ctx.path(), ui, opts))
+        # Merges were always run in the working copy before, which means
+        # they used decoded data, if the user defined any repository
+        # filters.
+        #
+        # Maintain that behavior today for BC, though perhaps in the future
+        # it'd be worth considering whether merging encoded data (what the
+        # repository usually sees) might be more useful.
+        return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
 
     class ctxwriter(object):
         def __init__(self, ctx):