##// END OF EJS Templates
filectx: use cmp(self, fctx) instead of cmp(self, text)...
Nicolas Dumazet -
r11702:eb07fbc2 default
parent child Browse files
Show More
@@ -352,12 +352,12 b' class filectx(object):'
352 def size(self):
352 def size(self):
353 return self._filelog.size(self._filerev)
353 return self._filelog.size(self._filerev)
354
354
355 def cmp(self, text):
355 def cmp(self, fctx):
356 """compare text with stored file revision
356 """compare with other file context
357
357
358 returns True if text is different than what is stored.
358 returns True if different than fctx.
359 """
359 """
360 return self._filelog.cmp(self._filenode, text)
360 return self._filelog.cmp(self._filenode, fctx.data())
361
361
362 def renamed(self):
362 def renamed(self):
363 """check if file was actually renamed in this changeset revision
363 """check if file was actually renamed in this changeset revision
@@ -935,12 +935,12 b' class workingfilectx(filectx):'
935 raise
935 raise
936 return (t, tz)
936 return (t, tz)
937
937
938 def cmp(self, text):
938 def cmp(self, fctx):
939 """compare text with disk content
939 """compare with other file context
940
940
941 returns True if text is different than what is on disk.
941 returns True if different than fctx.
942 """
942 """
943 return self._repo.wread(self._path) != text
943 return self._repo.wread(self._path) != fctx.data()
944
944
945 class memctx(object):
945 class memctx(object):
946 """Use memctx to perform in-memory commits via localrepo.commitctx().
946 """Use memctx to perform in-memory commits via localrepo.commitctx().
@@ -135,7 +135,7 b' def filemerge(repo, mynode, orig, fcd, f'
135 except IOError:
135 except IOError:
136 return False
136 return False
137
137
138 if not fco.cmp(fcd.data()): # files identical?
138 if not fco.cmp(fcd): # files identical?
139 return None
139 return None
140
140
141 if fca == fco: # backwards, use working dir parent as ancestor
141 if fca == fco: # backwards, use working dir parent as ancestor
@@ -1062,7 +1062,7 b' class localrepository(repo.repository):'
1062 # do a full compare of any files that might have changed
1062 # do a full compare of any files that might have changed
1063 for f in sorted(cmp):
1063 for f in sorted(cmp):
1064 if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f)
1064 if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f)
1065 or ctx1[f].cmp(ctx2[f].data())):
1065 or ctx1[f].cmp(ctx2[f])):
1066 modified.append(f)
1066 modified.append(f)
1067 else:
1067 else:
1068 fixup.append(f)
1068 fixup.append(f)
@@ -1106,7 +1106,7 b' class localrepository(repo.repository):'
1106 if fn in mf1:
1106 if fn in mf1:
1107 if (mf1.flags(fn) != mf2.flags(fn) or
1107 if (mf1.flags(fn) != mf2.flags(fn) or
1108 (mf1[fn] != mf2[fn] and
1108 (mf1[fn] != mf2[fn] and
1109 (mf2[fn] or ctx1[fn].cmp(ctx2[fn].data())))):
1109 (mf2[fn] or ctx1[fn].cmp(ctx2[fn])))):
1110 modified.append(fn)
1110 modified.append(fn)
1111 elif listclean:
1111 elif listclean:
1112 clean.append(fn)
1112 clean.append(fn)
@@ -73,7 +73,7 b' class mergestate(object):'
73 def _checkunknown(wctx, mctx):
73 def _checkunknown(wctx, mctx):
74 "check for collisions between unknown files and files in mctx"
74 "check for collisions between unknown files and files in mctx"
75 for f in wctx.unknown():
75 for f in wctx.unknown():
76 if f in mctx and mctx[f].cmp(wctx[f].data()):
76 if f in mctx and mctx[f].cmp(wctx[f]):
77 raise util.Abort(_("untracked file in working directory differs"
77 raise util.Abort(_("untracked file in working directory differs"
78 " from file in requested revision: '%s'") % f)
78 " from file in requested revision: '%s'") % f)
79
79
General Comments 0
You need to be logged in to leave comments. Login now