diff options
| -rw-r--r-- | project.py | 7 | ||||
| -rw-r--r-- | subcmds/rebase.py | 9 | ||||
| -rw-r--r-- | subcmds/start.py | 17 |
3 files changed, 25 insertions, 8 deletions
| @@ -1583,8 +1583,6 @@ class Project(object): | |||
| 1583 | 1583 | ||
| 1584 | if kill: | 1584 | if kill: |
| 1585 | old = self.bare_git.GetHead() | 1585 | old = self.bare_git.GetHead() |
| 1586 | if old is None: | ||
| 1587 | old = 'refs/heads/please_never_use_this_as_a_branch_name' | ||
| 1588 | 1586 | ||
| 1589 | try: | 1587 | try: |
| 1590 | self.bare_git.DetachHead(rev) | 1588 | self.bare_git.DetachHead(rev) |
| @@ -1596,7 +1594,10 @@ class Project(object): | |||
| 1596 | capture_stderr=True) | 1594 | capture_stderr=True) |
| 1597 | b.Wait() | 1595 | b.Wait() |
| 1598 | finally: | 1596 | finally: |
| 1599 | self.bare_git.SetHead(old) | 1597 | if ID_RE.match(old): |
| 1598 | self.bare_git.DetachHead(old) | ||
| 1599 | else: | ||
| 1600 | self.bare_git.SetHead(old) | ||
| 1600 | left = self._allrefs | 1601 | left = self._allrefs |
| 1601 | 1602 | ||
| 1602 | for branch in kill: | 1603 | for branch in kill: |
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index 1bdc1f0b..74796970 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
| @@ -54,6 +54,11 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 54 | p.add_option('--auto-stash', | 54 | p.add_option('--auto-stash', |
| 55 | dest='auto_stash', action='store_true', | 55 | dest='auto_stash', action='store_true', |
| 56 | help='Stash local modifications before starting') | 56 | help='Stash local modifications before starting') |
| 57 | p.add_option('-m', '--onto-manifest', | ||
| 58 | dest='onto_manifest', action='store_true', | ||
| 59 | help='Rebase onto the manifest version instead of upstream ' | ||
| 60 | 'HEAD. This helps to make sure the local tree stays ' | ||
| 61 | 'consistent if you previously synced to a manifest.') | ||
| 57 | 62 | ||
| 58 | def Execute(self, opt, args): | 63 | def Execute(self, opt, args): |
| 59 | all_projects = self.GetProjects(args) | 64 | all_projects = self.GetProjects(args) |
| @@ -106,6 +111,10 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 106 | if opt.interactive: | 111 | if opt.interactive: |
| 107 | args.append("-i") | 112 | args.append("-i") |
| 108 | 113 | ||
| 114 | if opt.onto_manifest: | ||
| 115 | args.append('--onto') | ||
| 116 | args.append(project.revisionExpr) | ||
| 117 | |||
| 109 | args.append(upbranch.LocalMerge) | 118 | args.append(upbranch.LocalMerge) |
| 110 | 119 | ||
| 111 | print('# %s: rebasing %s -> %s' | 120 | print('# %s: rebasing %s -> %s' |
diff --git a/subcmds/start.py b/subcmds/start.py index 940c3413..d1430a9d 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
| @@ -57,10 +57,15 @@ revision specified in the manifest. | |||
| 57 | print("error: at least one project must be specified", file=sys.stderr) | 57 | print("error: at least one project must be specified", file=sys.stderr) |
| 58 | sys.exit(1) | 58 | sys.exit(1) |
| 59 | 59 | ||
| 60 | all_projects = self.GetProjects(projects, | ||
| 61 | missing_ok=bool(self.gitc_manifest)) | ||
| 62 | |||
| 63 | # This must happen after we find all_projects, since GetProjects may need | ||
| 64 | # the local directory, which will disappear once we save the GITC manifest. | ||
| 60 | if self.gitc_manifest: | 65 | if self.gitc_manifest: |
| 61 | all_projects = self.GetProjects(projects, manifest=self.gitc_manifest, | 66 | gitc_projects = self.GetProjects(projects, manifest=self.gitc_manifest, |
| 62 | missing_ok=True) | 67 | missing_ok=True) |
| 63 | for project in all_projects: | 68 | for project in gitc_projects: |
| 64 | if project.old_revision: | 69 | if project.old_revision: |
| 65 | project.already_synced = True | 70 | project.already_synced = True |
| 66 | else: | 71 | else: |
| @@ -70,8 +75,10 @@ revision specified in the manifest. | |||
| 70 | # Save the GITC manifest. | 75 | # Save the GITC manifest. |
| 71 | gitc_utils.save_manifest(self.gitc_manifest) | 76 | gitc_utils.save_manifest(self.gitc_manifest) |
| 72 | 77 | ||
| 73 | all_projects = self.GetProjects(projects, | 78 | # Make sure we have a valid CWD |
| 74 | missing_ok=bool(self.gitc_manifest)) | 79 | if not os.path.exists(os.getcwd()): |
| 80 | os.chdir(self.manifest.topdir) | ||
| 81 | |||
| 75 | pm = Progress('Starting %s' % nb, len(all_projects)) | 82 | pm = Progress('Starting %s' % nb, len(all_projects)) |
| 76 | for project in all_projects: | 83 | for project in all_projects: |
| 77 | pm.update() | 84 | pm.update() |
