Mercurial > hg > easyhg
comparison easyhg.py @ 448:89b6ba707096
Don't try to chmod on Windows; doesn't work
author | Chris Cannam |
---|---|
date | Wed, 29 Jun 2011 12:59:33 +0100 |
parents | f72cad3baa34 |
children | f778dfb6a42f |
comparison
equal
deleted
inserted
replaced
447:8506333fe65c | 448:89b6ba707096 |
---|---|
11 # modify it under the terms of the GNU General Public License as | 11 # modify it under the terms of the GNU General Public License as |
12 # published by the Free Software Foundation; either version 2 of the | 12 # published by the Free Software Foundation; either version 2 of the |
13 # License, or (at your option) any later version. See the file | 13 # License, or (at your option) any later version. See the file |
14 # COPYING included with this distribution for more information. | 14 # COPYING included with this distribution for more information. |
15 | 15 |
16 import sys, os, stat, urllib, urllib2, urlparse | 16 import sys, os, stat, urllib, urllib2, urlparse, platform |
17 | 17 |
18 from mercurial.i18n import _ | 18 from mercurial.i18n import _ |
19 from mercurial import ui, util, error | 19 from mercurial import ui, util, error |
20 try: | 20 try: |
21 from mercurial.url import passwordmgr | 21 from mercurial.url import passwordmgr |
96 try: | 96 try: |
97 ofp = open(pfile, 'w') | 97 ofp = open(pfile, 'w') |
98 except: | 98 except: |
99 ui.write("failed to open authfile %s for writing\n" % pfile) | 99 ui.write("failed to open authfile %s for writing\n" % pfile) |
100 raise | 100 raise |
101 try: | 101 if platform.system() != 'Windows': |
102 #!!! Windows equivalent? | 102 try: |
103 os.fchmod(ofp.fileno(), stat.S_IRUSR | stat.S_IWUSR) | 103 os.fchmod(ofp.fileno(), stat.S_IRUSR | stat.S_IWUSR) |
104 except: | 104 except: |
105 ofp.close() | 105 ofp.close() |
106 ui.write("failed to set permissions on authfile %s\n" % pfile) | 106 ui.write("failed to set permissions on authfile %s\n" % pfile) |
107 raise | 107 raise |
108 pcfg.write(ofp) | 108 pcfg.write(ofp) |
109 ofp.close() | 109 ofp.close() |
110 | 110 |
111 def get_from_config(pcfg, sect, key): | 111 def get_from_config(pcfg, sect, key): |
112 data = None | 112 data = None |