Mercurial > hg-stable
comparison mercurial/util.py @ 1292:141951276ba1
Use platform-appropriate rc file names.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 21 Sep 2005 09:56:30 -0700 |
parents | 1546c2aa6b30 |
children | a6ffcebd3315 |
comparison
equal
deleted
inserted
replaced
1291:a942bf419a64 | 1292:141951276ba1 |
---|---|
43 files.setdefault(pf, 1) | 43 files.setdefault(pf, 1) |
44 code = fp.close() | 44 code = fp.close() |
45 if code: | 45 if code: |
46 raise Abort("patch command failed: exit status %s " % code) | 46 raise Abort("patch command failed: exit status %s " % code) |
47 return files.keys() | 47 return files.keys() |
48 | 48 |
49 def binary(s): | 49 def binary(s): |
50 """return true if a string is binary data using diff's heuristic""" | 50 """return true if a string is binary data using diff's heuristic""" |
51 if s and '\0' in s[:4096]: | 51 if s and '\0' in s[:4096]: |
52 return True | 52 return True |
53 return False | 53 return False |
329 | 329 |
330 # Platform specific variants | 330 # Platform specific variants |
331 if os.name == 'nt': | 331 if os.name == 'nt': |
332 nulldev = 'NUL:' | 332 nulldev = 'NUL:' |
333 | 333 |
334 rcpath = (r'c:\mercurial\mercurial.ini', | |
335 os.path.join(os.path.expanduser('~'), 'mercurial.ini')) | |
336 | |
334 def parse_patch_output(output_line): | 337 def parse_patch_output(output_line): |
335 """parses the output produced by patch and returns the file name""" | 338 """parses the output produced by patch and returns the file name""" |
336 pf = output_line[14:] | 339 pf = output_line[14:] |
337 if pf[0] == '`': | 340 if pf[0] == '`': |
338 pf = pf[1:-1] # Remove the quotes | 341 pf = pf[1:-1] # Remove the quotes |
380 def explain_exit(code): | 383 def explain_exit(code): |
381 return "exited with status %d" % code, code | 384 return "exited with status %d" % code, code |
382 | 385 |
383 else: | 386 else: |
384 nulldev = '/dev/null' | 387 nulldev = '/dev/null' |
388 | |
389 rcpath = map(os.path.normpath, | |
390 ('/etc/mercurial/hgrc', os.path.expanduser('~/.hgrc'))) | |
385 | 391 |
386 def parse_patch_output(output_line): | 392 def parse_patch_output(output_line): |
387 """parses the output produced by patch and returns the file name""" | 393 """parses the output produced by patch and returns the file name""" |
388 return output_line[14:] | 394 return output_line[14:] |
389 | 395 |