[PATCH 1 of 5 mergedriver] mergestate: raise exception if otherctx is accessed but _other isn't set

Siddharth Agarwal sid0 at fb.com
Mon Nov 30 18:34:51 UTC 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1448906709 28800
#      Mon Nov 30 10:05:09 2015 -0800
# Node ID 6ea95357d149d5e1b243bc57abd629962dfea072
# Parent  95c37d37acaeb0885a3220939d035649398e81c2
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r 6ea95357d149
mergestate: raise exception if otherctx is accessed but _other isn't set

We don't want to inadvertently return the workingctx (self._repo[None]).

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -288,6 +288,8 @@ class mergestate(object):
 
     @util.propertycache
     def otherctx(self):
+        if self._other is None:
+            raise RuntimeError("localctx accessed but self._local isn't set")
         return self._repo[self._other]
 
     def active(self):


More information about the Mercurial-devel mailing list