Mercurial > hg > config
comparison python/hgrc.py @ 351:971e7deca495
got --print working, maybe
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Thu, 27 Jun 2013 02:01:32 -0700 |
| parents | 52e718567731 |
| children | eeff298cc922 |
comparison
equal
deleted
inserted
replaced
| 350:52e718567731 | 351:971e7deca495 |
|---|---|
| 4 Script for modifying hgrc files. | 4 Script for modifying hgrc files. |
| 5 | 5 |
| 6 Actions: | 6 Actions: |
| 7 (TBD) | 7 (TBD) |
| 8 """ | 8 """ |
| 9 | 9 # imports |
| 10 import optparse | 10 import optparse |
| 11 import os | 11 import os |
| 12 import sys | 12 import sys |
| 13 | 13 from ConfigParser import RawCOnfigParser as ConfigParser |
| 14 here = os.path.dirname(os.path.realpath(__file__)) | |
| 15 | 14 |
| 16 def main(args=sys.argv[1:]): | 15 def main(args=sys.argv[1:]): |
| 17 | 16 |
| 18 # command line parser | 17 # command line parser |
| 19 usage = '%prog [options] repository <repository> <...>' | 18 usage = '%prog [options] repository <repository> <...>' |
| 54 else: | 53 else: |
| 55 not_hg.append(path) | 54 not_hg.append(path) |
| 56 continue | 55 continue |
| 57 else: | 56 else: |
| 58 assert os.path.isfile(path), "%s is not a file, exiting" % path | 57 assert os.path.isfile(path), "%s is not a file, exiting" % path |
| 58 hgrc.append(path) | |
| 59 | 59 |
| 60 if options.print: | |
| 61 # print the chosen hgrc paths and you're done | |
| 62 print '\n'.join(hgrc) | |
| 63 parser.exit() | |
| 60 | 64 |
| 61 if __name__ == '__main__': | 65 if __name__ == '__main__': |
| 62 main() | 66 main() |
