Commits

shirkey committed 2325c25

added environment variable to change version control system (default = hg)

  • Participants
  • Parent commits 0c79985

Comments (0)

Files changed (1)

File virtualenvwrapper/bitbucket.py

 
 log = logging.getLogger(__name__)
 
-def get_url(project):
+def get_url(project, vc_type='hg'):
     """Return the URL for the given project.
     """
     user = os.environ.get('VIRTUALENVWRAPPER_BITBUCKET_USER', os.environ.get('USER'))
     if not user:
         log.error('Set USER or VIRTUALENVWRAPPER_BITBUCKET_USER')
         return None
-    url = 'ssh://hg@bitbucket.org/{user}/{project}'.format(user=user, project=project)
+    url = 'ssh://{vc_type}@bitbucket.org/{user}/{project}'.format(vc_type = vc_type, \
+		user=user, project=project)
     return url
 
 def template(args):
     """Clones a BitBucket.org repository into the project directory.
     """
     project = args[0]
-    url = get_url(project)
+    vc_type = os.environ.get('VIRTUALENVWRAPPER_BITBUCKET_VCTYPE','hg')
+    url = get_url(project,vc_type)
     if url:
         log.info('Cloning %s', url)
-        subprocess.call(['hg', 'clone', url, project], shell=False)
+        subprocess.call([vc_type, 'clone', url, project], shell=False)
     return