if file not in theirs_newline_cache:
nl = git_newline_style(theirs_id, file)
if not isinstance(nl, str):
- # A case of incompetent upstream, unfortunately
- logging.warning("Canonical version (theirs) of %s has mixed newline style, forced to \\n", file)
+ if nl is not None:
+ # A case of incompetent upstream, unfortunately
+ logging.warning("Canonical version (theirs) of %s has mixed newline style, forced to \\n", file)
+ else:
+ logging.info("Canonical version (theirs) of %s had no newline style, using \\n", file)
nl = "\n"
theirs_newline_cache[file] = nl
return theirs_newline_cache[file]
theirs_tree = shell.eval("git", "rev-parse", "%s^{tree}" % theirs_id)
# operations on the ours tree
for file in git_diff_text(ours_id, theirs_id):
- theirs_nl = get_theirs_newline(file)
- ours_nl = get_newline(file) # current checkout is ours_id
+ try:
+ theirs_nl = get_theirs_newline(file)
+ ours_nl = get_newline(file) # current checkout is ours_id
+ except (IOError, shell.CallError): # hack
+ continue
if theirs_nl != ours_nl:
logging.info("Converting our file (3) from %s to %s newlines", repr(ours_nl), repr(theirs_nl))
convert_newline(file, theirs_nl)
# operations on the common tree
shell.call("git", "reset", "--hard", common_id)
for file in git_diff_text(common_id, theirs_id):
- theirs_nl = get_theirs_newline(file)
- common_nl = get_newline(file) # current checkout is common_id
+ try:
+ theirs_nl = get_theirs_newline(file)
+ common_nl = get_newline(file) # current checkout is common_id
+ except (IOError, shell.CallError): # hack
+ continue
if theirs_nl != common_nl:
logging.info("Converting common file (1) from %s to %s newlines", repr(common_nl), repr(theirs_nl))
convert_newline(file, theirs_nl)