summaryrefslogtreecommitdiffstats
path: root/llvm/utils/git-svn
diff options
context:
space:
mode:
authorDavid Zarzycki <dave@znu.io>2019-09-17 04:44:13 +0000
committerDavid Zarzycki <dave@znu.io>2019-09-17 04:44:13 +0000
commit73f2dbb7d24d646d6c31fa008911f18844102c98 (patch)
treef7153b24835a65d3a45d6c606a35c8eb5545242c /llvm/utils/git-svn
parent95aea7449493e6711a326a8a76b086f87e580619 (diff)
downloadbcm5719-llvm-73f2dbb7d24d646d6c31fa008911f18844102c98.tar.gz
bcm5719-llvm-73f2dbb7d24d646d6c31fa008911f18844102c98.zip
[git-llvm] Do not reinvent `@{upstream}` (take 2)
This makes git-llvm more of a thin wrapper around git while temporarily maintaining backwards compatibility with past git-llvm behavior. Using @{upstream} makes git-llvm more robust when used with a nontrivial local repository. https://reviews.llvm.org/D67389 llvm-svn: 372070
Diffstat (limited to 'llvm/utils/git-svn')
-rwxr-xr-xllvm/utils/git-svn/git-llvm18
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm
index 3ab9d31b4b1..debe6a5ea20 100755
--- a/llvm/utils/git-svn/git-llvm
+++ b/llvm/utils/git-svn/git-llvm
@@ -191,16 +191,16 @@ def program_exists(cmd):
def get_default_rev_range():
- # Get the branch tracked by the current branch, as set by
- # git branch --set-upstream-to See http://serverfault.com/a/352236/38694.
- cur_branch = git('rev-parse', '--symbolic-full-name', 'HEAD')
- upstream_branch = git('for-each-ref', '--format=%(upstream:short)',
- cur_branch)
- if not upstream_branch:
- upstream_branch = 'origin/master'
-
# Get the newest common ancestor between HEAD and our upstream branch.
- upstream_rev = git('merge-base', 'HEAD', upstream_branch)
+ upstream_rev = git('merge-base', 'HEAD', '@{upstream}', ignore_errors=True)
+ if not upstream_rev:
+ eprint("Warning: git-llvm assumes that origin/master is the upstream "
+ "branch but git does not.")
+ eprint("To make this warning go away: git branch -u origin/master")
+ eprint("To avoid this warning when creating branches: "
+ "git checkout -b MyBranchName origin/master")
+ upstream_rev = git('merge-base', 'HEAD', 'origin/master')
+
return '%s..' % upstream_rev
OpenPOWER on IntegriCloud