Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Set vcs.branch to the branch name when using git #1

Merged
merged 1 commit into from Aug 22, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions isotoma/recipe/facts/__init__.py
Expand Up @@ -91,6 +91,19 @@ def set_vcs(self):
elif os.path.exists(os.path.join(vcs_dir, ".git")):
self.options["vcs.type"] = "git"

old = os.getcwd()
os.chdir(vcs_dir)

p = subprocess.Popen(['git', 'branch'], stdout=subprocess.PIPE)
s, e = p.communicate()

for line in s.split('\n'):
if line.startswith('*'):
self.options['vcs.branch'] = line[2:]
break

os.chdir(old)

def install(self):
return ()

Expand Down