##// END OF EJS Templates
Make context __eq__ handle arbitrary RHS values
Brendan Cully -
r3715:6cb3aca6 default
parent child Browse files
Show More
@@ -36,7 +36,10 b' class changectx(object):'
36 return "<changectx %s>" % str(self)
36 return "<changectx %s>" % str(self)
37
37
38 def __eq__(self, other):
38 def __eq__(self, other):
39 return self._rev == other._rev
39 try:
40 return self._rev == other._rev
41 except AttributeError:
42 return False
40
43
41 def __nonzero__(self):
44 def __nonzero__(self):
42 return self._rev != nullrev
45 return self._rev != nullrev
@@ -176,7 +179,11 b' class filectx(object):'
176 return "<filectx %s>" % str(self)
179 return "<filectx %s>" % str(self)
177
180
178 def __eq__(self, other):
181 def __eq__(self, other):
179 return self._path == other._path and self._changeid == other._changeid
182 try:
183 return (self._path == other._path
184 and self._changeid == other._changeid)
185 except AttributeError:
186 return False
180
187
181 def filectx(self, fileid):
188 def filectx(self, fileid):
182 '''opens an arbitrary revision of the file without
189 '''opens an arbitrary revision of the file without
@@ -139,9 +139,9 b' def findcopies(repo, m1, m2, ma, limit):'
139 ''' check if an apparent pair actually matches '''
139 ''' check if an apparent pair actually matches '''
140 c2 = ctx(f2, man[f2])
140 c2 = ctx(f2, man[f2])
141 ca = c.ancestor(c2)
141 ca = c.ancestor(c2)
142 if c == ca or c2 == ca:
142 if not ca or c == ca or c2 == ca:
143 return
143 return
144 if ca and ca.path() == c.path() or ca.path() == c2.path():
144 if ca.path() == c.path() or ca.path() == c2.path():
145 copy[c.path()] = f2
145 copy[c.path()] = f2
146 copy[f2] = c.path()
146 copy[f2] = c.path()
147
147
General Comments 0
You need to be logged in to leave comments. Login now