##// 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 861 f = fctx.path()
862 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 869 def parents(f):
870 rev = f.rev()
871 if rev not in parentscache:
872 parentscache[rev] = []
865 873 for p in f.parents():
866 yield {
867 "node": p.hex(),
868 "rev": p.rev(),
874 entry = {
875 'node': p.hex(),
876 'rev': p.rev(),
869 877 }
878 parentscache[rev].append(entry)
879
880 for p in parentscache[rev]:
881 yield p
870 882
871 883 def annotate(**map):
872 884 if util.binary(fctx.data()):
@@ -392,8 +392,7 b' class abstractvfs(object):'
392 392 newstat = util.filestat(dstpath)
393 393 if newstat.isambig(oldstat):
394 394 # stat of renamed file is ambiguous to original one
395 advanced = (oldstat.stat.st_mtime + 1) & 0x7fffffff
396 os.utime(dstpath, (advanced, advanced))
395 newstat.avoidambig(dstpath, oldstat)
397 396 return ret
398 397 return util.rename(self.join(src), dstpath)
399 398
@@ -1460,8 +1459,7 b' class checkambigatclosing(closewrapbase)'
1460 1459 newstat = util.filestat(self._origfh.name)
1461 1460 if newstat.isambig(oldstat):
1462 1461 # stat of changed file is ambiguous to original one
1463 advanced = (oldstat.stat.st_mtime + 1) & 0x7fffffff
1464 os.utime(self._origfh.name, (advanced, advanced))
1462 newstat.avoidambig(self._origfh.name, oldstat)
1465 1463
1466 1464 def __exit__(self, exc_type, exc_value, exc_tb):
1467 1465 self._origfh.__exit__(exc_type, exc_value, exc_tb)
@@ -1499,6 +1499,24 b' class filestat(object):'
1499 1499 except AttributeError:
1500 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 1520 def __ne__(self, other):
1503 1521 return not self == other
1504 1522
General Comments 0
You need to be logged in to leave comments. Login now