Skip to content

Instantly share code, notes, and snippets.

@mattn
Created December 14, 2011 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/1475303 to your computer and use it in GitHub Desktop.
Save mattn/1475303 to your computer and use it in GitHub Desktop.
diff -r ea37ecc7b847 lib/codereview/codereview.py
--- a/lib/codereview/codereview.py Wed Dec 14 13:17:48 2011 +1100
+++ b/lib/codereview/codereview.py Wed Dec 14 13:48:34 2011 +0900
@@ -353,7 +353,7 @@
response_body = MySend("/upload", body, content_type=ctype)
patchset = None
msg = response_body
- lines = msg.splitlines()
+ lines = msg.split("\n")
if len(lines) >= 2:
msg = lines[0]
patchset = lines[1].strip()
@@ -1620,7 +1620,7 @@
# line numbers are +newdelta from what they were before.
def fileDeltas(repo, file, oldver, newver):
cmd = ["hg", "diff", "--git", "-r", oldver + ":" + newver, "path:" + file]
- data = RunShell(cmd, silent_ok=True)
+ data = RunShell(cmd, silent_ok=True, universal_newlines=False)
deltas = []
for line in data.splitlines():
m = re.match('@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@', line)
@@ -3308,10 +3308,10 @@
# If no file specified, restrict to the current subdir
extra_args = extra_args or ["."]
cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
- data = RunShell(cmd, silent_ok=True)
+ data = RunShell(cmd, silent_ok=True, universal_newlines=False)
svndiff = []
filecount = 0
- for line in data.splitlines():
+ for line in data.split("\n"):
m = re.match("diff --git a/(\S+) b/(\S+)", line)
if m:
# Modify line to make it look like as it comes from svn diff.
@@ -3336,7 +3336,7 @@
status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
silent_ok=True)
unknown_files = []
- for line in status.splitlines():
+ for line in status.split("\n"):
st, fn = line.split(" ", 1)
if st == "?":
unknown_files.append(fn)
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="content_upload"
1
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="reviewers"
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="cc"
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="description"
test: fix codereview.py
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="base_hashes"
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="issue"
5483068
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="subject"
diff -r ea37ecc7b847 http://go.googlecode.com/hg/
---M-A-G-I-C---B-O-U-N-D-A-R-Y-
Content-Disposition: form-data; name="data"; filename="data.diff"
Content-Type: application/octet-stream
Index: misc/windows/goenv.bat
===================================================================
--- a/misc/windows/goenv.bat
+++ b/misc/windows/goenv.bat
@@ -17,6 +17,7 @@
echo Unable to find the Go compiler
echo This batch file must run from the root Go folder
pause
+echo test
exit
:ok
---M-A-G-I-C---B-O-U-N-D-A-R-Y---
http://codereview.appspot.com/5483068
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment