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

Side by Side Diff: git_reparent_branch.py

Issue 184253003: Add git-reup and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@freeze_thaw
Patch Set: Created 6 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 import sys
3
4 from git_common import upstream, current_branch, run
5 from git_common import get_or_create_merge_base_tag
6
7 def main(argv):
8 # TODO(iannucci): Add --verbose
Ryan Tseng 2014/02/28 21:22:05 Add --help. "reparent branch" also isn't self evi
9
10 assert len(argv) == 2, "Must supply new parent"
11 branch = current_branch()
12 new_parent = argv[1]
13 cur_parent = upstream(branch)
14 assert branch != 'HEAD', 'Must be on the branch you want to reparent'
agable 2014/02/28 20:14:16 Could let them specify the branch they want to rep
iannucci 2014/03/20 10:59:37 added TODO
15 assert cur_parent != new_parent
16
17 get_or_create_merge_base_tag(branch, cur_parent)
18
19 print "Reparenting %s to track %s (was %s)" % (branch, new_parent, cur_parent)
20 run('branch', '--set-upstream-to', new_parent, branch)
21 try:
22 cmd = ['reup'] #+ (['--verbose'] if VERBOSE else [])
23 run(*cmd, stdout=None, stderr=None)
24 except:
25 print "Resetting parent back to %s" % (cur_parent)
26 run('branch', '--set-upstream-to', cur_parent, branch)
27 raise
28
29 return 0
30
31
32 if __name__ == '__main__':
33 sys.exit(main(sys.argv))
34
35
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698