summaryrefslogtreecommitdiffstats
path: root/llvm/utils/git-svn/git-llvm
diff options
context:
space:
mode:
authorMehdi Amini <joker.eph@gmail.com>2019-09-10 01:26:36 +0000
committerMehdi Amini <joker.eph@gmail.com>2019-09-10 01:26:36 +0000
commitdaa79c5338228a746a7eba0cf2f2f356e1d45a5b (patch)
tree94b88055b10575a9f32f0bdeecca3eb04244774b /llvm/utils/git-svn/git-llvm
parent939614341227c0c2a65860520bb82ad832d3415b (diff)
downloadbcm5719-llvm-daa79c5338228a746a7eba0cf2f2f356e1d45a5b.tar.gz
bcm5719-llvm-daa79c5338228a746a7eba0cf2f2f356e1d45a5b.zip
Revert [git-llvm] Do not reinvent `@{upstream}`
This reverts r371290 (git commit 7faffd544b16f851a632d6b8f93e3c8485ff34bb) The change wasnt NFC and broke some users' workflow. Reverting while figuring out the best alternative to move forward. llvm-svn: 371480
Diffstat (limited to 'llvm/utils/git-svn/git-llvm')
-rwxr-xr-xllvm/utils/git-svn/git-llvm14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm
index e03479a6df1..549a45558dd 100755
--- a/llvm/utils/git-svn/git-llvm
+++ b/llvm/utils/git-svn/git-llvm
@@ -190,8 +190,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}')
+ upstream_rev = git('merge-base', 'HEAD', upstream_branch)
return '%s..' % upstream_rev
@@ -629,7 +637,9 @@ if __name__ == '__main__':
metavar='GIT_REVS',
type=str,
nargs='?',
- help="revs to push (default: everything not in the upstream branch).")
+ help="revs to push (default: everything not in the branch's "
+ 'upstream, or not in origin/master if the branch lacks '
+ 'an explicit upstream)')
parser_push.set_defaults(func=cmd_push)
parser_revert = subcommands.add_parser(
OpenPOWER on IntegriCloud