From b9a1b73425773dc97843f92aeee9c57c9a08c0f7 Mon Sep 17 00:00:00 2001 From: Simran Basi Date: Thu, 20 Aug 2015 12:19:28 -0700 Subject: GITC: Add repo start support. Add repo start support for GITC checkouts. If the user is in the GITC FS view, they can now run repo start to check out the sources and create a new working branch. When "repo start" is called on a GITC project, the revision tag is set to an empty string and saved in a new tag: old-revision. This tells the GITC filesystem to display the local copy of the sources when being viewed. The local copy is created by pulling the project sources and the new branch is created based off the original project revision. Updated main.py to setup each command's gitc_manifest when appropriate. Updated repo sync's logic to sync opened projects and updating the GITC manifest file for the rest. Change-Id: I7e4809d1c4fc43c69b26f2f1bebe45aab0cae628 --- command.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'command.py') diff --git a/command.py b/command.py index 38cacd3b..78dab96d 100644 --- a/command.py +++ b/command.py @@ -106,13 +106,13 @@ class Command(object): def _UpdatePathToProjectMap(self, project): self._by_path[project.worktree] = project - def _GetProjectByPath(self, path): + def _GetProjectByPath(self, manifest, path): project = None if os.path.exists(path): oldpath = None while path \ and path != oldpath \ - and path != self.manifest.topdir: + and path != manifest.topdir: try: project = self._by_path[path] break @@ -126,13 +126,16 @@ class Command(object): pass return project - def GetProjects(self, args, groups='', missing_ok=False, submodules_ok=False): + def GetProjects(self, args, manifest=None, groups='', missing_ok=False, + submodules_ok=False): """A list of projects that match the arguments. """ - all_projects_list = self.manifest.projects + if not manifest: + manifest = self.manifest + all_projects_list = manifest.projects result = [] - mp = self.manifest.manifestProject + mp = manifest.manifestProject if not groups: groups = mp.config.GetString('manifest.groups') @@ -155,11 +158,11 @@ class Command(object): self._ResetPathToProjectMap(all_projects_list) for arg in args: - projects = self.manifest.GetProjectsWithName(arg) + projects = manifest.GetProjectsWithName(arg) if not projects: path = os.path.abspath(arg).replace('\\', '/') - project = self._GetProjectByPath(path) + project = self._GetProjectByPath(manifest, path) # If it's not a derived project, update path->project mapping and # search again, as arg might actually point to a derived subproject. @@ -170,7 +173,7 @@ class Command(object): self._UpdatePathToProjectMap(subproject) search_again = True if search_again: - project = self._GetProjectByPath(path) or project + project = self._GetProjectByPath(manifest, path) or project if project: projects = [project] -- cgit v1.2.3-54-g00ecf