Permalink
Browse files

Added support for git submodules

  • Loading branch information...
1 parent c704b10 commit 2e2716bab33c415e0785e074cfcc145b8a26e881 @JordanReiter committed Dec 30, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 pip/vcs/git.py
View
@@ -85,6 +85,11 @@ def switch(self, dest, url, rev_options):
[self.cmd, 'config', 'remote.origin.url', url], cwd=dest)
call_subprocess(
[self.cmd, 'checkout', '-q'] + rev_options, cwd=dest)
+ self.update_submodules(dest)
+
+ def update_submodules(self, dest):
+ call_subprocess([self.cmd, 'submodule', 'init', '-q'], cwd=dest)
+ call_subprocess([self.cmd, 'submodule', 'update', '-q'], cwd=dest)
def update(self, dest, rev_options):
# First fetch changes from the default remote
@@ -93,6 +98,7 @@ def update(self, dest, rev_options):
if rev_options:
rev_options = self.check_rev_options(rev_options[0], dest, rev_options)
call_subprocess([self.cmd, 'reset', '--hard', '-q'] + rev_options, cwd=dest)
+ self.update_submodules(dest)
def obtain(self, dest):
url, rev = self.get_url_rev()
@@ -104,7 +110,7 @@ def obtain(self, dest):
rev_display = ''
if self.check_destination(dest, url, rev_options, rev_display):
logger.notify('Cloning %s%s to %s' % (url, rev_display, display_path(dest)))
- call_subprocess([self.cmd, 'clone', '-q', url, dest])
+ call_subprocess([self.cmd, 'clone', '--recursive', '-q', url, dest])
if rev:
rev_options = self.check_rev_options(rev, dest, rev_options)
# Only do a checkout if rev_options differs from HEAD
@@ -203,4 +209,4 @@ def _get_revision_from_rev_parse(self, name, location):
show_stdout=False, cwd=location)
-vcs.register(Git)
+vcs.register(Git)

0 comments on commit 2e2716b

Please sign in to comment.