[PATCH] D26565: Improve `git llvm push` to suggest `git pull` when applying patch fails
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 11 17:27:40 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL286695: Improve `git llvm push` to suggest `git pull` when applying patch fails (authored by mehdi_amini).
Changed prior to commit:
https://reviews.llvm.org/D26565?vs=77673&id=77704#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26565
Files:
llvm/trunk/utils/git-svn/git-llvm
Index: llvm/trunk/utils/git-svn/git-llvm
===================================================================
--- llvm/trunk/utils/git-svn/git-llvm
+++ llvm/trunk/utils/git-svn/git-llvm
@@ -82,7 +82,7 @@
d = head
-def shell(cmd, strip=True, cwd=None, stdin=None):
+def shell(cmd, strip=True, cwd=None, stdin=None, die_on_failure=True):
log_verbose('Running: %s' % ' '.join(cmd))
start = time.time()
@@ -100,10 +100,13 @@
if strip:
stdout = stdout.rstrip('\r\n')
return stdout
- eprint('`%s` returned %s' % (' '.join(cmd), p.returncode))
+ err_msg = '`%s` returned %s' % (' '.join(cmd), p.returncode)
+ eprint(err_msg)
if stderr:
eprint(stderr.rstrip())
- sys.exit(2)
+ if die_on_failure:
+ sys.exit(2)
+ raise RuntimeError(err_msg)
def git(*cmd, **kwargs):
@@ -187,7 +190,13 @@
svn_sr_path = os.path.join(svn_repo, GIT_TO_SVN_DIR[sr])
# git is the only thing that can handle its own patches...
log_verbose('Apply patch: %s' % diff)
- shell(['git', 'apply', '-p2', '-'], cwd=svn_sr_path, stdin=diff)
+ try:
+ shell(['git', 'apply', '-p2', '-'], cwd=svn_sr_path, stdin=diff,
+ die_on_failure=False)
+ except RuntimeError as e:
+ eprint("Patch doesn't apply: maybe you should try `git pull -r` "
+ "first?")
+ sys.exit(2)
status_lines = svn(svn_repo, 'status').split('\n')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26565.77704.patch
Type: text/x-patch
Size: 1494 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161112/34631e2c/attachment.bin>
More information about the llvm-commits
mailing list