|
|
@ -102,22 +102,18 @@ VCS_CVS = "CVS"
|
|
|
|
VCS_UNKNOWN = "Unknown"
|
|
|
|
VCS_UNKNOWN = "Unknown"
|
|
|
|
|
|
|
|
|
|
|
|
VCS = [
|
|
|
|
VCS = [
|
|
|
|
{
|
|
|
|
{'name': VCS_MERCURIAL,
|
|
|
|
'name': VCS_MERCURIAL,
|
|
|
|
'aliases': ['hg', 'mercurial']},
|
|
|
|
'aliases': ['hg', 'mercurial'],
|
|
|
|
{'name': VCS_SUBVERSION,
|
|
|
|
}, {
|
|
|
|
'aliases': ['svn', 'subversion'],},
|
|
|
|
'name': VCS_SUBVERSION,
|
|
|
|
{'name': VCS_PERFORCE,
|
|
|
|
'aliases': ['svn', 'subversion'],
|
|
|
|
'aliases': ['p4', 'perforce']},
|
|
|
|
}, {
|
|
|
|
{'name': VCS_GIT,
|
|
|
|
'name': VCS_PERFORCE,
|
|
|
|
'aliases': ['git']},
|
|
|
|
'aliases': ['p4', 'perforce'],
|
|
|
|
{'name': VCS_CVS,
|
|
|
|
}, {
|
|
|
|
'aliases': ['cvs']},
|
|
|
|
'name': VCS_GIT,
|
|
|
|
]
|
|
|
|
'aliases': ['git'],
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
'name': VCS_CVS,
|
|
|
|
|
|
|
|
'aliases': ['cvs'],
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VCS_SHORT_NAMES = [] # hg, svn, ...
|
|
|
|
VCS_SHORT_NAMES = [] # hg, svn, ...
|
|
|
|
VCS_ABBREVIATIONS = {} # alias: name, ...
|
|
|
|
VCS_ABBREVIATIONS = {} # alias: name, ...
|
|
|
@ -461,7 +457,7 @@ class AbstractRpcServer(object):
|
|
|
|
for header, value in extra_headers.items():
|
|
|
|
for header, value in extra_headers.items():
|
|
|
|
req.add_header(header, value)
|
|
|
|
req.add_header(header, value)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
f = self.opener.open(req)
|
|
|
|
f = self.opener.open(req, timeout=70)
|
|
|
|
response = f.read()
|
|
|
|
response = f.read()
|
|
|
|
f.close()
|
|
|
|
f.close()
|
|
|
|
return response
|
|
|
|
return response
|
|
|
@ -680,8 +676,11 @@ group.add_option("--emulate_svn_auto_props", action="store_true",
|
|
|
|
group = parser.add_option_group("Git-specific options")
|
|
|
|
group = parser.add_option_group("Git-specific options")
|
|
|
|
group.add_option("--git_similarity", action="store", dest="git_similarity",
|
|
|
|
group.add_option("--git_similarity", action="store", dest="git_similarity",
|
|
|
|
metavar="SIM", type="int", default=50,
|
|
|
|
metavar="SIM", type="int", default=50,
|
|
|
|
help=("Set the minimum similarity index for detecting renames "
|
|
|
|
help=("Set the minimum similarity percentage for detecting "
|
|
|
|
"and copies. See `git diff -C`. (default 50)."))
|
|
|
|
"renames and copies. See `git diff -C`. (default 50)."))
|
|
|
|
|
|
|
|
group.add_option("--git_only_search_patch", action="store_false", default=True,
|
|
|
|
|
|
|
|
dest='git_find_copies_harder',
|
|
|
|
|
|
|
|
help="Removes --find-copies-harder when seaching for copies")
|
|
|
|
group.add_option("--git_no_find_copies", action="store_false", default=True,
|
|
|
|
group.add_option("--git_no_find_copies", action="store_false", default=True,
|
|
|
|
dest="git_find_copies",
|
|
|
|
dest="git_find_copies",
|
|
|
|
help=("Prevents git from looking for copies (default off)."))
|
|
|
|
help=("Prevents git from looking for copies (default off)."))
|
|
|
@ -1009,7 +1008,7 @@ use_shell = sys.platform.startswith("win")
|
|
|
|
def RunShellWithReturnCodeAndStderr(command, print_output=False,
|
|
|
|
def RunShellWithReturnCodeAndStderr(command, print_output=False,
|
|
|
|
universal_newlines=True,
|
|
|
|
universal_newlines=True,
|
|
|
|
env=os.environ):
|
|
|
|
env=os.environ):
|
|
|
|
"""Executes a command and returns the output from stdout, stderr and the return code.
|
|
|
|
"""Run a command and return output from stdout, stderr and the return code.
|
|
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Args:
|
|
|
|
command: Command to execute.
|
|
|
|
command: Command to execute.
|
|
|
@ -1048,7 +1047,7 @@ def RunShellWithReturnCodeAndStderr(command, print_output=False,
|
|
|
|
def RunShellWithReturnCode(command, print_output=False,
|
|
|
|
def RunShellWithReturnCode(command, print_output=False,
|
|
|
|
universal_newlines=True,
|
|
|
|
universal_newlines=True,
|
|
|
|
env=os.environ):
|
|
|
|
env=os.environ):
|
|
|
|
"""Executes a command and returns the output from stdout and the return code."""
|
|
|
|
"""Run a command and return output from stdout and the return code."""
|
|
|
|
out, err, retcode = RunShellWithReturnCodeAndStderr(command, print_output,
|
|
|
|
out, err, retcode = RunShellWithReturnCodeAndStderr(command, print_output,
|
|
|
|
universal_newlines, env)
|
|
|
|
universal_newlines, env)
|
|
|
|
return out, retcode
|
|
|
|
return out, retcode
|
|
|
@ -1223,7 +1222,8 @@ class VersionControlSystem(object):
|
|
|
|
mimetype = mimetypes.guess_type(filename)[0]
|
|
|
|
mimetype = mimetypes.guess_type(filename)[0]
|
|
|
|
if not mimetype:
|
|
|
|
if not mimetype:
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
return mimetype.startswith("image/") and not mimetype.startswith("image/svg")
|
|
|
|
return (mimetype.startswith("image/") and
|
|
|
|
|
|
|
|
not mimetype.startswith("image/svg"))
|
|
|
|
|
|
|
|
|
|
|
|
def IsBinaryData(self, data):
|
|
|
|
def IsBinaryData(self, data):
|
|
|
|
"""Returns true if data contains a null byte."""
|
|
|
|
"""Returns true if data contains a null byte."""
|
|
|
@ -1341,6 +1341,7 @@ class SubversionVCS(VersionControlSystem):
|
|
|
|
if m.group(2):
|
|
|
|
if m.group(2):
|
|
|
|
return "$%s::%s$" % (m.group(1), " " * len(m.group(3)))
|
|
|
|
return "$%s::%s$" % (m.group(1), " " * len(m.group(3)))
|
|
|
|
return "$%s$" % m.group(1)
|
|
|
|
return "$%s$" % m.group(1)
|
|
|
|
|
|
|
|
|
|
|
|
keywords = [keyword
|
|
|
|
keywords = [keyword
|
|
|
|
for name in keyword_str.split(" ")
|
|
|
|
for name in keyword_str.split(" ")
|
|
|
|
for keyword in svn_keywords.get(name, [])]
|
|
|
|
for keyword in svn_keywords.get(name, [])]
|
|
|
@ -1393,7 +1394,8 @@ class SubversionVCS(VersionControlSystem):
|
|
|
|
if returncode:
|
|
|
|
if returncode:
|
|
|
|
# Directory might not yet exist at start revison
|
|
|
|
# Directory might not yet exist at start revison
|
|
|
|
# svn: Unable to find repository location for 'abc' in revision nnn
|
|
|
|
# svn: Unable to find repository location for 'abc' in revision nnn
|
|
|
|
if re.match('^svn: Unable to find repository location for .+ in revision \d+', err):
|
|
|
|
if re.match('^svn: Unable to find repository location '
|
|
|
|
|
|
|
|
'for .+ in revision \d+', err):
|
|
|
|
old_files = ()
|
|
|
|
old_files = ()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
ErrorExit("Failed to get status for %s:\n%s" % (filename, err))
|
|
|
|
ErrorExit("Failed to get status for %s:\n%s" % (filename, err))
|
|
|
@ -1615,16 +1617,18 @@ class GitVCS(VersionControlSystem):
|
|
|
|
# append a diff (with rename detection), without deletes.
|
|
|
|
# append a diff (with rename detection), without deletes.
|
|
|
|
cmd = [
|
|
|
|
cmd = [
|
|
|
|
"git", "diff", "--no-color", "--no-ext-diff", "--full-index",
|
|
|
|
"git", "diff", "--no-color", "--no-ext-diff", "--full-index",
|
|
|
|
"--ignore-submodules",
|
|
|
|
"--ignore-submodules", "--src-prefix=a/", "--dst-prefix=b/",
|
|
|
|
]
|
|
|
|
]
|
|
|
|
diff = RunShell(
|
|
|
|
diff = RunShell(
|
|
|
|
cmd + ["--no-renames", "--diff-filter=D"] + extra_args,
|
|
|
|
cmd + ["--no-renames", "--diff-filter=D"] + extra_args,
|
|
|
|
env=env, silent_ok=True)
|
|
|
|
env=env, silent_ok=True)
|
|
|
|
|
|
|
|
assert 0 <= self.options.git_similarity <= 100
|
|
|
|
if self.options.git_find_copies:
|
|
|
|
if self.options.git_find_copies:
|
|
|
|
similarity_options = ["--find-copies-harder", "-l100000",
|
|
|
|
similarity_options = ["-l100000", "-C%d%%" % self.options.git_similarity]
|
|
|
|
"-C%s" % self.options.git_similarity ]
|
|
|
|
if self.options.git_find_copies_harder:
|
|
|
|
|
|
|
|
similarity_options.append("--find-copies-harder")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
similarity_options = ["-M%s" % self.options.git_similarity ]
|
|
|
|
similarity_options = ["-M%d%%" % self.options.git_similarity ]
|
|
|
|
diff += RunShell(
|
|
|
|
diff += RunShell(
|
|
|
|
cmd + ["--diff-filter=AMCRT"] + similarity_options + extra_args,
|
|
|
|
cmd + ["--diff-filter=AMCRT"] + similarity_options + extra_args,
|
|
|
|
env=env, silent_ok=True)
|
|
|
|
env=env, silent_ok=True)
|
|
|
|