diff options
| -rwxr-xr-x | project.py | 8 | ||||
| -rw-r--r-- | subcmds/start.py | 7 |
2 files changed, 12 insertions, 3 deletions
| @@ -1697,7 +1697,7 @@ class Project(object): | |||
| 1697 | 1697 | ||
| 1698 | # Branch Management ## | 1698 | # Branch Management ## |
| 1699 | 1699 | ||
| 1700 | def StartBranch(self, name, branch_merge=''): | 1700 | def StartBranch(self, name, branch_merge='', revision=None): |
| 1701 | """Create a new branch off the manifest's revision. | 1701 | """Create a new branch off the manifest's revision. |
| 1702 | """ | 1702 | """ |
| 1703 | if not branch_merge: | 1703 | if not branch_merge: |
| @@ -1718,7 +1718,11 @@ class Project(object): | |||
| 1718 | branch.merge = branch_merge | 1718 | branch.merge = branch_merge |
| 1719 | if not branch.merge.startswith('refs/') and not ID_RE.match(branch_merge): | 1719 | if not branch.merge.startswith('refs/') and not ID_RE.match(branch_merge): |
| 1720 | branch.merge = R_HEADS + branch_merge | 1720 | branch.merge = R_HEADS + branch_merge |
| 1721 | revid = self.GetRevisionId(all_refs) | 1721 | |
| 1722 | if revision is None: | ||
| 1723 | revid = self.GetRevisionId(all_refs) | ||
| 1724 | else: | ||
| 1725 | revid = self.work_git.rev_parse(revision) | ||
| 1722 | 1726 | ||
| 1723 | if head.startswith(R_HEADS): | 1727 | if head.startswith(R_HEADS): |
| 1724 | try: | 1728 | try: |
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 | ||
