Patchwork [1,of,7,mergedriver] mergestate: add a constructor that reads state from disk

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 18, 2015, 5:48 a.m.
Message ID <225459dfc6cad4033946.1447825710@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11461/
State Accepted
Headers show

Comments

Siddharth Agarwal - Nov. 18, 2015, 5:48 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1447797330 28800
#      Tue Nov 17 13:55:30 2015 -0800
# Node ID 225459dfc6cad40339467f2ba72b33f00709b6d6
# Parent  a895afbcc1cd13e6207acbfc164d2afa8e917bb3
mergestate: add a constructor that reads state from disk

At the moment it's the same as just creating a new mergestate, but we'll soon
move the _read call out of __init__ and in here.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -83,6 +83,12 @@  class mergestate(object):
         ms.reset(node, other)
         return ms
 
+    @staticmethod
+    def read(repo):
+        """Initialize the merge state, reading it from disk."""
+        ms = mergestate(repo)
+        return ms
+
     def __init__(self, repo):
         self._repo = repo
         self._dirty = False