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

Side by Side Diff: git_cl.py

Issue 811023003: Added error check that we are on a branch when we try to upload. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Unintentional whitespace change Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 return 1 1859 return 1
1860 1860
1861 options.reviewers = cleanup_list(options.reviewers) 1861 options.reviewers = cleanup_list(options.reviewers)
1862 options.cc = cleanup_list(options.cc) 1862 options.cc = cleanup_list(options.cc)
1863 1863
1864 cl = Changelist() 1864 cl = Changelist()
1865 if args: 1865 if args:
1866 # TODO(ukai): is it ok for gerrit case? 1866 # TODO(ukai): is it ok for gerrit case?
1867 base_branch = args[0] 1867 base_branch = args[0]
1868 else: 1868 else:
1869 if cl.GetBranch() is None:
1870 DieWithError('Can\'t upload from detached HEAD state. Get on a branch!')
1871
1869 # Default to diffing against common ancestor of upstream branch 1872 # Default to diffing against common ancestor of upstream branch
1870 base_branch = cl.GetCommonAncestorWithUpstream() 1873 base_branch = cl.GetCommonAncestorWithUpstream()
1871 args = [base_branch, 'HEAD'] 1874 args = [base_branch, 'HEAD']
1872 1875
1873 # Apply watchlists on upload. 1876 # Apply watchlists on upload.
1874 change = cl.GetChange(base_branch, None) 1877 change = cl.GetChange(base_branch, None)
1875 watchlist = watchlists.Watchlists(change.RepositoryRoot()) 1878 watchlist = watchlists.Watchlists(change.RepositoryRoot())
1876 files = [f.LocalPath() for f in change.AffectedFiles()] 1879 files = [f.LocalPath() for f in change.AffectedFiles()]
1877 if not options.bypass_watchlists: 1880 if not options.bypass_watchlists:
1878 cl.SetWatchers(watchlist.GetWatchersForPaths(files)) 1881 cl.SetWatchers(watchlist.GetWatchersForPaths(files))
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
2935 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2938 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2936 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2939 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2937 2940
2938 2941
2939 if __name__ == '__main__': 2942 if __name__ == '__main__':
2940 # These affect sys.stdout so do it outside of main() to simplify mocks in 2943 # These affect sys.stdout so do it outside of main() to simplify mocks in
2941 # unit testing. 2944 # unit testing.
2942 fix_encoding.fix_encoding() 2945 fix_encoding.fix_encoding()
2943 colorama.init() 2946 colorama.init()
2944 sys.exit(main(sys.argv[1:])) 2947 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698