mercurial/version.py
changeset 461 9ae0034f2772
parent 429 688d03d6997a
child 464 50da4bb9cab6
equal deleted inserted replaced
460:6409d9a0df43 461:9ae0034f2772
    11 
    11 
    12 import os
    12 import os
    13 import os.path
    13 import os.path
    14 import re
    14 import re
    15 import time
    15 import time
       
    16 import util
    16 
    17 
    17 unknown_version = 'unknown'
    18 unknown_version = 'unknown'
    18 remembered_version = False
    19 remembered_version = False
    19 
    20 
    20 def get_version():
    21 def get_version():
    35 
    36 
    36 def remember_version(version=None):
    37 def remember_version(version=None):
    37     """Store version information."""
    38     """Store version information."""
    38     global remembered_version
    39     global remembered_version
    39     if not version and os.path.isdir(".hg"):
    40     if not version and os.path.isdir(".hg"):
    40         f = os.popen("hg identify 2>/dev/null")  # use real hg installation
    41         f = os.popen("hg identify 2> %s" % util.nulldev)  # use real hg installation
    41         ident = f.read()[:-1]
    42         ident = f.read()[:-1]
    42         if not f.close() and ident:
    43         if not f.close() and ident:
    43             ids = ident.split(' ', 1)
    44             ids = ident.split(' ', 1)
    44             version = ids.pop(0)
    45             version = ids.pop(0)
    45             if version[-1] == '+':
    46             if version[-1] == '+':