summaryrefslogtreecommitdiff
path: root/tool/vcs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index d7559a7..9371ae2 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -135,7 +135,8 @@ class VCS
info_xml = IO.pread(%W"svn info --xml #{path}")
_, last, _, changed, _ = info_xml.split(/revision="(\d+)"/)
modified = info_xml[/<date>([^<>]*)/, 1]
- [last, changed, modified]
+ branch = info_xml[%r'<relative-url>\^/(?:branches/|tags/)?([^<>]*)', 1]
+ [last, changed, modified, branch]
end
def url
@@ -205,7 +206,11 @@ class VCS
changed = last
end
modified = log[/^Date:\s+(.*)/, 1]
- [last, changed, modified]
+ cmd = %W[git]
+ cmd.push("-C", srcdir) if srcdir
+ cmd.push("symbolic-ref", "HEAD")
+ branch = IO.pread(cmd)[%r'\A(?:refs/heads/)?(.*)', 1]
+ [last, changed, modified, branch]
end
Branch = Struct.new(:to_str)