From a1e7754c630b0d7cea8eeaec87f956f6555517e4 Mon Sep 17 00:00:00 2001 From: Ricky Zhou Date: Sun, 5 Dec 2010 20:07:07 -0500 Subject: Handle anonymous clones in clone_with_dirs. (#660183) --- src/pyfedpkg/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index a1edb35..16dc291 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -430,6 +430,12 @@ def clone_with_dirs(module, user, path=None): top_git = git.Git(top_path) repo_path = os.path.join(top_path, 'fedpkg.git') + # construct the git url + if user: + giturl = GITBASEURL % {'user': user, 'module': module} + else: + giturl = ANONGITURL % {'module': module} + # Create our new top directory try: os.mkdir(top_path) @@ -455,8 +461,7 @@ def clone_with_dirs(module, user, path=None): # Set the origin correctly branch_path = os.path.join(top_path, branch.split('/master')[0]) branch_git = git.Git(branch_path) - branch_git.config("--replace-all", "remote.origin.url", - GITBASEURL % {'user': user, 'module': module}) + branch_git.config("--replace-all", "remote.origin.url", giturl) branch_git.config('--add', 'push.default', 'tracking') except (git.GitCommandError, OSError), e: raise FedpkgError('Could not locally clone %s from %s: %s' % -- cgit