mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 11:27:49 +00:00
Bug 882101 - toggle trailing whitespace in client.py update_nss/nspr must be based on old state, r=wtc
This commit is contained in:
parent
985cd83653
commit
2e8fad5479
37
client.py
37
client.py
@ -95,6 +95,31 @@ def toggle_trailing_blank_line(depname):
|
||||
# adding blank line
|
||||
open(depname, "ab").write("\n")
|
||||
|
||||
def get_trailing_blank_line_state(depname):
|
||||
lines = open(depname, "r").readlines()
|
||||
if not lines:
|
||||
print >>sys.stderr, "unexpected short file"
|
||||
return "no blank line"
|
||||
|
||||
if not lines[-1].strip():
|
||||
return "has blank line"
|
||||
else:
|
||||
return "no blank line"
|
||||
|
||||
def update_nspr_or_nss(tag, depfile, destination, hgpath):
|
||||
print "reverting to HG version of %s to get its blank line state" % depfile
|
||||
check_call_noisy([options.hg, 'revert', depfile])
|
||||
old_state = get_trailing_blank_line_state(depfile)
|
||||
print "old state of %s is: %s" % (depfile, old_state)
|
||||
do_hg_replace(destination, hgpath, tag, HG_EXCLUSIONS, options.hg)
|
||||
new_state = get_trailing_blank_line_state(depfile)
|
||||
print "new state of %s is: %s" % (depfile, new_state)
|
||||
if old_state == new_state:
|
||||
print "toggling blank line in: ", depfile
|
||||
toggle_trailing_blank_line(depfile)
|
||||
tag_file = destination + "/TAG-INFO"
|
||||
print >>file(tag_file, "w"), tag
|
||||
|
||||
o = OptionParser(usage="client.py [options] update_nspr tagname | update_nss tagname | update_libffi tagname | update_webidlparser tagname")
|
||||
o.add_option("--skip-mozilla", dest="skip_mozilla",
|
||||
action="store_true", default=False,
|
||||
@ -119,16 +144,12 @@ if action in ('checkout', 'co'):
|
||||
pass
|
||||
elif action in ('update_nspr'):
|
||||
tag, = args[1:]
|
||||
do_hg_replace('nsprpub', 'https://hg.mozilla.org/projects/nspr',
|
||||
tag, HG_EXCLUSIONS, options.hg)
|
||||
print >>file("nsprpub/TAG-INFO", "w"), tag
|
||||
toggle_trailing_blank_line("nsprpub/config/prdepend.h")
|
||||
depfile = "nsprpub/config/prdepend.h"
|
||||
update_nspr_or_nss(tag, depfile, 'nsprpub', 'https://hg.mozilla.org/projects/nspr')
|
||||
elif action in ('update_nss'):
|
||||
tag, = args[1:]
|
||||
do_hg_replace('security/nss', 'https://hg.mozilla.org/projects/nss',
|
||||
tag, HG_EXCLUSIONS, options.hg)
|
||||
print >>file("security/nss/TAG-INFO", "w"), tag
|
||||
toggle_trailing_blank_line("security/nss/coreconf/coreconf.dep")
|
||||
depfile = "security/nss/coreconf/coreconf.dep"
|
||||
update_nspr_or_nss(tag, depfile, 'security/nss', 'https://hg.mozilla.org/projects/nss')
|
||||
elif action in ('update_libffi'):
|
||||
tag, = args[1:]
|
||||
if not options.cvsroot:
|
||||
|
Loading…
x
Reference in New Issue
Block a user