Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: git_cl.py

Issue 224863006: Abort `git cl push` if pushing into a local branch. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: restrict to non git-svn repos Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 9dabe20889840485c07800df09deb96d50820f89..f2f3434e3b8a8557589def595d07e6a8a826fd42 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1744,7 +1744,7 @@ def IsSubmoduleMergeCommit(ref):
def SendUpstream(parser, args, cmd):
"""Common code for CmdPush and CmdDCommit
- Squashed commit into a single.
+ Squashes branch into a single commit.
Updates changelog with metadata (e.g. pointer to review).
Pushes/dcommits the code upstream.
Updates review and closes.
@@ -1763,6 +1763,21 @@ def SendUpstream(parser, args, cmd):
(options, args) = parser.parse_args(args)
cl = Changelist()
+ current = cl.GetBranch()
+ remote, upstream_branch = cl.FetchUpstreamTuple(cl.GetBranch())
+ if not settings.GetIsGitSvn() and remote == '.':
+ print
+ print 'Attempting to push branch %r into another local branch!' % current
+ print
+ print 'Either reparent this branch on top of origin/master:'
+ print ' git reparent-branch --root'
+ print
+ print 'OR run `git rebase-update` if you think the parent branch is already'
+ print 'committed.'
+ print
+ print ' Current parent: %r' % upstream_branch
+ return 1
+
if not args or cmd == 'push':
# Default to merging against our best guess of the upstream branch.
args = [cl.GetUpstreamBranch()]
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698