Permalink
Browse files

Issue 89055: Fix 'hg cat' revision option when a range is given (issu…

…e127).

git-svn-id: http://rietveld.googlecode.com/svn/trunk@426 e30e9e8f-1b4c-0410-881d-6f13584adfe0
  • Loading branch information...
albrecht.andi
albrecht.andi committed Jun 30, 2009
1 parent e79665d commit 5af5fcc1a6fea037b31624a9d4a660d5f5e26fb6
Showing with 6 additions and 2 deletions.
  1. +6 −2 static/upload.py
@@ -1155,16 +1155,20 @@ def GetBaseFile(self, filename):
status = "M"
else:
status, _ = out[0].split(' ', 1)
if ":" in self.base_rev:
base_rev = self.base_rev.split(":", 1)[0]
else:
base_rev = self.base_rev
if status != "A":
base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath],
silent_ok=True)
is_binary = "\0" in base_content # Mercurial's heuristic
if status != "R":
new_content = open(relpath, "rb").read()
is_binary = is_binary or "\0" in new_content
if is_binary and base_content:
# Fetch again without converting newlines
base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath],
silent_ok=True, universal_newlines=False)
if not is_binary or not self.IsImage(relpath):
new_content = None

0 comments on commit 5af5fcc

Please sign in to comment.