summaryrefslogtreecommitdiffstats
path: root/subcmds/start.py
diff options
context:
space:
mode:
authorTheodore Dubois <tbodt@google.com>2019-07-30 12:14:25 -0700
committerMike Frysinger <vapier@google.com>2019-09-04 04:34:50 +0000
commit60fdc5cad126fb5664ee957b91edd1c304bfc513 (patch)
tree0fff7d8a99ee6e25189147610b26acf2707989dc /subcmds/start.py
parent46702eddc7b5f38391e121e47f0ab4dbd6fbdf58 (diff)
downloadgit-repo-60fdc5cad126fb5664ee957b91edd1c304bfc513.tar.gz
Add repo start option to create the branch based off HEAD
This makes it way easier to recover from forgetting to run repo start before committing: just run `repo start -b new-branch`, instead of all that tedious mucking around with reflogs. Change-Id: I56d49dce5d027e28fbba0507ac10cd763ccfc36d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/232712 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/start.py')
-rw-r--r--subcmds/start.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/subcmds/start.py b/subcmds/start.py
index 5d4c9c01..6ec0b2ce 100644
--- a/subcmds/start.py
+++ b/subcmds/start.py
@@ -40,6 +40,10 @@ revision specified in the manifest.
40 p.add_option('--all', 40 p.add_option('--all',
41 dest='all', action='store_true', 41 dest='all', action='store_true',
42 help='begin branch in all projects') 42 help='begin branch in all projects')
43 p.add_option('-r', '--rev', '--revision', dest='revision',
44 help='point branch at this revision instead of upstream')
45 p.add_option('--head', dest='revision', action='store_const', const='HEAD',
46 help='abbreviation for --rev HEAD')
43 47
44 def ValidateOptions(self, opt, args): 48 def ValidateOptions(self, opt, args):
45 if not args: 49 if not args:
@@ -108,7 +112,8 @@ revision specified in the manifest.
108 else: 112 else:
109 branch_merge = self.manifest.default.revisionExpr 113 branch_merge = self.manifest.default.revisionExpr
110 114
111 if not project.StartBranch(nb, branch_merge=branch_merge): 115 if not project.StartBranch(
116 nb, branch_merge=branch_merge, revision=opt.revision):
112 err.append(project) 117 err.append(project)
113 pm.end() 118 pm.end()
114 119