##// END OF EJS Templates
merge with stable
Augie Fackler -
r30417:854190be merge default
parent child Browse files
Show More
@@ -861,12 +861,24 b' def annotate(web, req, tmpl):'
861 f = fctx.path()
861 f = fctx.path()
862 parity = paritygen(web.stripecount)
862 parity = paritygen(web.stripecount)
863
863
864 # parents() is called once per line and several lines likely belong to
865 # same revision. So it is worth caching.
866 # TODO there are still redundant operations within basefilectx.parents()
867 # and from the fctx.annotate() call itself that could be cached.
868 parentscache = {}
864 def parents(f):
869 def parents(f):
865 for p in f.parents():
870 rev = f.rev()
866 yield {
871 if rev not in parentscache:
867 "node": p.hex(),
872 parentscache[rev] = []
868 "rev": p.rev(),
873 for p in f.parents():
869 }
874 entry = {
875 'node': p.hex(),
876 'rev': p.rev(),
877 }
878 parentscache[rev].append(entry)
879
880 for p in parentscache[rev]:
881 yield p
870
882
871 def annotate(**map):
883 def annotate(**map):
872 if util.binary(fctx.data()):
884 if util.binary(fctx.data()):
@@ -392,8 +392,7 b' class abstractvfs(object):'
392 newstat = util.filestat(dstpath)
392 newstat = util.filestat(dstpath)
393 if newstat.isambig(oldstat):
393 if newstat.isambig(oldstat):
394 # stat of renamed file is ambiguous to original one
394 # stat of renamed file is ambiguous to original one
395 advanced = (oldstat.stat.st_mtime + 1) & 0x7fffffff
395 newstat.avoidambig(dstpath, oldstat)
396 os.utime(dstpath, (advanced, advanced))
397 return ret
396 return ret
398 return util.rename(self.join(src), dstpath)
397 return util.rename(self.join(src), dstpath)
399
398
@@ -1460,8 +1459,7 b' class checkambigatclosing(closewrapbase)'
1460 newstat = util.filestat(self._origfh.name)
1459 newstat = util.filestat(self._origfh.name)
1461 if newstat.isambig(oldstat):
1460 if newstat.isambig(oldstat):
1462 # stat of changed file is ambiguous to original one
1461 # stat of changed file is ambiguous to original one
1463 advanced = (oldstat.stat.st_mtime + 1) & 0x7fffffff
1462 newstat.avoidambig(self._origfh.name, oldstat)
1464 os.utime(self._origfh.name, (advanced, advanced))
1465
1463
1466 def __exit__(self, exc_type, exc_value, exc_tb):
1464 def __exit__(self, exc_type, exc_value, exc_tb):
1467 self._origfh.__exit__(exc_type, exc_value, exc_tb)
1465 self._origfh.__exit__(exc_type, exc_value, exc_tb)
@@ -1499,6 +1499,24 b' class filestat(object):'
1499 except AttributeError:
1499 except AttributeError:
1500 return False
1500 return False
1501
1501
1502 def avoidambig(self, path, old):
1503 """Change file stat of specified path to avoid ambiguity
1504
1505 'old' should be previous filestat of 'path'.
1506
1507 This skips avoiding ambiguity, if a process doesn't have
1508 appropriate privileges for 'path'.
1509 """
1510 advanced = (old.stat.st_mtime + 1) & 0x7fffffff
1511 try:
1512 os.utime(path, (advanced, advanced))
1513 except OSError as inst:
1514 if inst.errno == errno.EPERM:
1515 # utime() on the file created by another user causes EPERM,
1516 # if a process doesn't have appropriate privileges
1517 return
1518 raise
1519
1502 def __ne__(self, other):
1520 def __ne__(self, other):
1503 return not self == other
1521 return not self == other
1504
1522
General Comments 0
You need to be logged in to leave comments. Login now