Mercurial > hg > config
annotate python/install_config.py @ 27:3b88a6c02421
update hgrc settings wrt https://developer.mozilla.org/en/Mercurial_FAQ
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 09 Mar 2010 12:08:18 -0500 |
parents | 8da594377f18 |
children | 8344c7a9847c |
rev | line source |
---|---|
1 | 1 #!/usr/bin/env python |
2 """ | |
3 installs config to a user's home directory | |
4 this can be done with | |
16 | 5 curl http://k0s.org/hg/config/raw-file/tip/python/install_config.py | python |
1 | 6 """ |
7 | |
8 SRC='http://k0s.org/hg/config' | |
9 import os | |
6 | 10 import sys |
14
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
11 HOME=os.environ['HOME'] |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
12 os.chdir(HOME) |
1 | 13 |
14 # make the current directory a repository | |
15 import subprocess | |
6 | 16 |
17 commands = [ ['hg', 'init'], | |
18 ['hg', 'pull', SRC], | |
14
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
19 ['hg', 'update', '-C'], |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
20 |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
21 # site-specific files |
22
8da594377f18
updates so installation wont break if no .subversion directory
k0s <k0scist@gmail.com>
parents:
16
diff
changeset
|
22 ['mkdir', '-p', '.subversion'], |
8da594377f18
updates so installation wont break if no .subversion directory
k0s <k0scist@gmail.com>
parents:
16
diff
changeset
|
23 ['rm', '-f', '.subversion/config'], |
14
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
24 ['ln', '-s', os.path.join(HOME, '.subversion_config/config'), os.path.join(HOME, '.subversion/config')], |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
25 ] |
6 | 26 |
27 for command in commands: | |
28 code = subprocess.call(command) | |
29 if code: | |
30 sys.exit(code) | |
1 | 31 |
32 | |
6 | 33 |