DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (31ec81b5d7bb)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#!/usr/bin/python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.


from optparse import OptionParser
from datetime import datetime
import time
import sys
import os

o = OptionParser()
o.add_option("--buildid", dest="buildid")
o.add_option("--print-buildid", action="store_true", dest="print_buildid")
o.add_option("--print-timestamp", action="store_true", dest="print_timestamp")
o.add_option("--sourcestamp", dest="sourcestamp")
o.add_option("--sourcerepo", dest="sourcerepo")

(options, args) = o.parse_args()

if options.print_timestamp:
    print int(time.time())
    sys.exit(0)

if options.print_buildid:
    print datetime.now().strftime('%Y%m%d%H%M%S')
    sys.exit(0)

if not options.buildid:
    print >>sys.stderr, "--buildid is required"
    sys.exit(1)

(milestoneFile,) = args
for line in open(milestoneFile, 'r'):
    if line[0] == '#':
        continue

    line = line.strip()
    if line == '':
        continue

    milestone = line

print """[Build]
BuildID=%s
Milestone=%s""" % (options.buildid, milestone)
if options.sourcestamp:
    print "SourceStamp=%s" % options.sourcestamp
if options.sourcerepo:
    print "SourceRepository=%s" % options.sourcerepo