Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 6835:08d9e0f974d9
make mq and tags hardlink safe
The code didn't check for modes like "r+" or "rb+".
Many thanks to agriffis for noticing it.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 23 Jul 2008 16:08:20 +0200 |
parents | ed9b07a97587 |
children | c016dc1a8e91 1d38f3605b20 |
comparison
equal
deleted
inserted
replaced
6815:7d6622eaad08 | 6835:08d9e0f974d9 |
---|---|
1425 | 1425 |
1426 if not text and "b" not in mode: | 1426 if not text and "b" not in mode: |
1427 mode += "b" # for that other OS | 1427 mode += "b" # for that other OS |
1428 | 1428 |
1429 nlink = -1 | 1429 nlink = -1 |
1430 if mode[0] != "r": | 1430 if mode not in ("r", "rb"): |
1431 try: | 1431 try: |
1432 nlink = nlinks(f) | 1432 nlink = nlinks(f) |
1433 except OSError: | 1433 except OSError: |
1434 nlink = 0 | 1434 nlink = 0 |
1435 d = os.path.dirname(f) | 1435 d = os.path.dirname(f) |