LSSTApplications
10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
sconsUtils
11.0.rc3
python
lsst
sconsUtils
vcs
git.py
Go to the documentation of this file.
1
#
2
# A simple python interface to git, using os.popen
3
# Based on the svn interface.
4
#
5
# If ever we want to do anything clever, we should use one of
6
# the supported python packages
7
#
8
from
__future__
import
absolute_import, division, print_function
9
import
os
10
import
re
11
from
..
import
state
12
from
..
import
utils
13
14
def
guessVersionName
():
15
"""Guess a version name"""
16
17
if
not
os.path.exists(
".git"
):
18
state.log.warn(
"Cannot guess version without .git directory; version will be set to 'unknown'."
)
19
return
"unknown"
20
status = utils.runExternal(
"git status --porcelain --untracked-files=no"
, fatal=
True
)
21
if
status.strip():
22
raise
RuntimeError(
"Error with git version: uncommitted changes"
)
23
desc = utils.runExternal(
"git describe --tags --always"
, fatal=
True
)
24
return
desc.strip()
25
26
def
guessFingerprint
():
27
"""Return (fingerprint, modified) where fingerprint is the repository's SHA1"""
28
fingerprint, modified =
"0x0"
,
False
29
30
if
not
os.path.exists(
".git"
):
31
state.log.warn(
"Cannot guess fingerprint without .git directory; will be set to '%s'."
32
% fingerprint)
33
else
:
34
status = utils.runExternal(
"git status --porcelain --untracked-files=no"
, fatal=
True
)
35
if
status.strip():
36
modified =
True
37
output = utils.runExternal(
"git rev-parse HEAD"
, fatal=
False
)
38
39
fingerprint = output.strip()
40
41
return
fingerprint, modified
lsst.sconsUtils.vcs.git.guessFingerprint
def guessFingerprint
Definition:
git.py:26
lsst.sconsUtils.vcs.git.guessVersionName
def guessVersionName
Definition:
git.py:14
Generated on Wed Sep 16 2015 13:35:35 for LSSTApplications by
1.8.5