diff options
-rwxr-xr-x | morph | 3 | ||||
-rw-r--r-- | morphlib/sourcemanager.py | 6 | ||||
-rwxr-xr-x | tests.branching/branch-creates-new-system-branch.script | 4 | ||||
-rw-r--r-- | tests.branching/branch-creates-new-system-branch.stdout | 11 |
4 files changed, 23 insertions, 1 deletions
@@ -410,6 +410,9 @@ class Morph(cliapp.Application): # Clone it from cache to target directory. morphlib.git.clone(dirname, treeish.repo, self.msg) + + # Set the origin to point at the original repository. + morphlib.git.set_remote(dirname, 'origin', treeish.original_repo) def cmd_branch(self, args): '''Branch the whole system.''' diff --git a/morphlib/sourcemanager.py b/morphlib/sourcemanager.py index 21c99fa9..2747a2c9 100644 --- a/morphlib/sourcemanager.py +++ b/morphlib/sourcemanager.py @@ -164,6 +164,7 @@ class SourceManager(object): repo_urls = [urlparse.urljoin(fixup_url(x), repo) for x in self.settings['git-base-url']] + orig_url = None cached_repo = None errors = [] @@ -172,6 +173,7 @@ class SourceManager(object): quoted_url = quote_url(repo_url) cached_repo_dirname = os.path.join(self.cache_dir, quoted_url) if os.path.exists(cached_repo_dirname): + orig_url = repo_url cached_repo = cached_repo_dirname break @@ -183,6 +185,7 @@ class SourceManager(object): cached_repo, error = self._cache_repo_from_bundle(server, repo_url) if cached_repo: + orig_url = repo_url break else: errors.append(error) @@ -193,6 +196,7 @@ class SourceManager(object): for repo_url in repo_urls: cached_repo, error = self._cache_repo_from_url(repo_url) if cached_repo: + orig_url = repo_url break else: errors.append(error) @@ -227,7 +231,7 @@ class SourceManager(object): # we should have a cached version of the repo now, return a treeish # for the repo and ref tuple - treeish = morphlib.git.Treeish(cached_repo, repo, ref, self.msg) + treeish = morphlib.git.Treeish(cached_repo, orig_url, ref, self.msg) self.indent_less() return treeish diff --git a/tests.branching/branch-creates-new-system-branch.script b/tests.branching/branch-creates-new-system-branch.script index 07e12f5f..61e9daf4 100755 --- a/tests.branching/branch-creates-new-system-branch.script +++ b/tests.branching/branch-creates-new-system-branch.script @@ -29,3 +29,7 @@ echo "File tree:" echo "Current branches:" "$SRCDIR/scripts/run-git-in" newbranch/morphs branch + +echo "Current origin:" +"$SRCDIR/scripts/run-git-in" newbranch/morphs remote show origin | + sed 's,\(TMP/mine/\.morph/cache/gits/file_\).*_,\1,g' diff --git a/tests.branching/branch-creates-new-system-branch.stdout b/tests.branching/branch-creates-new-system-branch.stdout index 1381fcfe..53256da5 100644 --- a/tests.branching/branch-creates-new-system-branch.stdout +++ b/tests.branching/branch-creates-new-system-branch.stdout @@ -13,3 +13,14 @@ f ./newbranch/morphs/hello-system.chunk Current branches: master * newbranch +Current origin: +* remote origin + Fetch URL: file://TMP/morphs + Push URL: file://TMP/morphs + HEAD branch: master + Remote branch: + master tracked + Local branch configured for 'git pull': + master merges with remote master + Local ref configured for 'git push': + master pushes to master (up to date) |