##// END OF EJS Templates
merge.mergestate: only check for merge driver when property is accessed...
Siddharth Agarwal -
r26768:ac68769a default
parent child Browse files
Show More
@@ -90,6 +90,7 b' class mergestate(object):'
90 90 self._local = node
91 91 self._other = other
92 92 self._mdstate = 'u'
93 self._readmergedriver = None
93 94 shutil.rmtree(self._repo.join('merge'), True)
94 95 self._dirty = False
95 96
@@ -105,6 +106,7 b' class mergestate(object):'
105 106 self._mdstate = 'u'
106 107 if 'otherctx' in vars(self):
107 108 del self.otherctx
109 self._readmergedriver = None
108 110 records = self._readrecords()
109 111 for rtype, record in records:
110 112 if rtype == 'L':
@@ -118,18 +120,7 b' class mergestate(object):'
118 120 # the merge driver should be idempotent, so just rerun it
119 121 mdstate = 'u'
120 122
121 # protect against the following:
122 # - A configures a malicious merge driver in their hgrc, then
123 # pauses the merge
124 # - A edits their hgrc to remove references to the merge driver
125 # - A gives a copy of their entire repo, including .hg, to B
126 # - B inspects .hgrc and finds it to be clean
127 # - B then continues the merge and the malicious merge driver
128 # gets invoked
129 if self.mergedriver != bits[0]:
130 raise error.ConfigError(
131 _("merge driver changed since merge started"),
132 hint=_("revert merge driver change or abort merge"))
123 self._readmergedriver = bits[0]
133 124 self._mdstate = mdstate
134 125 elif rtype in 'FD':
135 126 bits = record.split('\0')
@@ -236,7 +227,23 b' class mergestate(object):'
236 227
237 228 @util.propertycache
238 229 def mergedriver(self):
239 return self._repo.ui.config('experimental', 'mergedriver')
230 # protect against the following:
231 # - A configures a malicious merge driver in their hgrc, then
232 # pauses the merge
233 # - A edits their hgrc to remove references to the merge driver
234 # - A gives a copy of their entire repo, including .hg, to B
235 # - B inspects .hgrc and finds it to be clean
236 # - B then continues the merge and the malicious merge driver
237 # gets invoked
238 configmergedriver = self._repo.ui.config('experimental', 'mergedriver')
239 if (self._readmergedriver is not None
240 and self._readmergedriver != configmergedriver):
241 raise error.ConfigError(
242 _("merge driver changed since merge started"),
243 hint=_("revert merge driver change or abort merge"))
244
245 return configmergedriver
246
240 247 @util.propertycache
241 248 def otherctx(self):
242 249 return self._repo[self._other]
General Comments 0
You need to be logged in to leave comments. Login now