Git Revision Template Tag

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import subprocess
from django.template import Library

register = Library()

try:
    head = subprocess.Popen("git rev-parse --short HEAD",
        shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    VERSION = head.stdout.readline().strip()
except:
    VERSION = u'unknown'


@register.simple_tag()
def git_short_version():
    return VERSION

More like this

  1. Reshape list for table, flatten index in nested loops by aquagnu 5 years, 2 months ago
  2. Digg-like pagination by SmileyChris 3 years, 12 months ago
  3. Use git log to give your app a revision by peterbe 3 years, 6 months ago
  4. Page numbers with ... like in Digg by Ciantic 4 years, 1 month ago
  5. Text Highlighting Filter by girasquid 4 years, 5 months ago

Comments

(Forgotten your password?)