##// END OF EJS Templates
copies-rust: rename Oracle.is_ancestor to Oracle.is_overwrite...
copies-rust: rename Oracle.is_ancestor to Oracle.is_overwrite The core information that we want here is about "does information from revision X overwrite information in Y". To do so, we check is X is an ancestors of Y, but this is an implementation details, they could be other ways. We update the naming to clarify this (and align more with wording used in upcoming changesets. For people curious about other ways: for example we could record the overwrite graph as it happens and reuse that to check if X overwrite Y, without having to do potential expensive `is_ancestor` call on the revision graph. Differential Revision: https://phab.mercurial-scm.org/D9496

File last commit:

r43346:2372284d default
r46769:ecbb2fc9 default
Show More
casesmash.py
41 lines | 934 B | text/x-python | PythonLexer
Pulkit Goyal
casesmash: use absolute_import
r28351 from __future__ import absolute_import
import __builtin__
import os
Augie Fackler
formatting: blacken the codebase...
r43346 from mercurial import util
Matt Mackall
merge with stable
r14730
def lowerwrap(scope, funcname):
f = getattr(scope, funcname)
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 def wrap(fname, *args, **kwargs):
d, base = os.path.split(fname)
try:
files = os.listdir(d or '.')
Simon Heimberg
cleanup: drop unused variables and an unused import
r19378 except OSError:
Matt Mackall
merge with stable
r14730 files = []
if base in files:
return f(fname, *args, **kwargs)
for fn in files:
if fn.lower() == base.lower():
return f(os.path.join(d, fn), *args, **kwargs)
return f(fname, *args, **kwargs)
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 scope.__dict__[funcname] = wrap
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 def normcase(path):
return path.lower()
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 os.path.normcase = normcase
for f in 'file open'.split():
lowerwrap(__builtin__, f)
for f in "chmod chown open lstat stat remove unlink".split():
lowerwrap(os, f)
for f in "exists lexists".split():
lowerwrap(os.path, f)
lowerwrap(util, 'posixfile')