summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-07-03 10:11:33 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-07-03 11:29:16 +0100
commitff1f0e456f0bb632d17d4e85470209343663de1f (patch)
tree59a6e6c4807d1d4fb86cdad804612afbcbb02556 /morphlib
parent42f9ad14cf1343de6d29c4459abf95b262d909cb (diff)
downloadmorph-ff1f0e456f0bb632d17d4e85470209343663de1f.tar.gz
morph branching: use git-config to set pushInsteadOf
This is the standard way of altering config, it shouldn't be done by modifying the config file. This may allow better forward compatibility if the config keys or storage format change.
Diffstat (limited to 'morphlib')
-rwxr-xr-xmorphlib/app.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index a8cad8a2..e1554951 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -806,11 +806,9 @@ class Morph(cliapp.Application):
morphlib.git.set_remote(self.runcmd, dirname, 'origin', repo.url)
# Add push url rewrite rule to .git/config.
- filename = os.path.join(dirname, '.git', 'config')
- with open(filename, 'a') as f:
- f.write('\n')
- f.write('[url "%s"]\n' % repo_resolver.push_url(reponame))
- f.write('\tpushInsteadOf = %s\n' %repo_resolver.pull_url(reponame))
+ self.runcmd(['git', 'config',
+ 'url.%s.pushInsteadOf'% repo_resolver.push_url(reponame),
+ repo_resolver.pull_url(reponame)], cwd=dirname)
# Update remotes.
self.runcmd(['git', 'remote', 'update'], cwd=dirname)