Mercurial > hg-stable
changeset 12032:ad787252fed6
util: remove lexists, Python 2.4 introduced os.path.lexists
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 25 Aug 2010 16:23:32 +0200 |
parents | 77bbeafd7519 |
children | 41def6704d01 |
files | mercurial/cmdutil.py mercurial/commands.py mercurial/merge.py mercurial/patch.py mercurial/util.py |
diffstat | 5 files changed, 5 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Aug 25 13:40:46 2010 +0200 +++ b/mercurial/cmdutil.py Wed Aug 25 16:23:32 2010 +0200 @@ -297,7 +297,7 @@ unknown.append(abs) if repo.ui.verbose or not exact: repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) - elif repo.dirstate[abs] != 'r' and (not good or not util.lexists(target) + elif repo.dirstate[abs] != 'r' and (not good or not os.path.lexists(target) or (os.path.isdir(target) and not os.path.islink(target))): deleted.append(abs) if repo.ui.verbose or not exact:
--- a/mercurial/commands.py Wed Aug 25 13:40:46 2010 +0200 +++ b/mercurial/commands.py Wed Aug 25 16:23:32 2010 +0200 @@ -3166,7 +3166,7 @@ target = repo.wjoin(abs) def handle(xlist, dobackup): xlist[0].append(abs) - if dobackup and not opts.get('no_backup') and util.lexists(target): + if dobackup and not opts.get('no_backup') and os.path.lexists(target): bakname = "%s.orig" % rel ui.note(_('saving current version of %s as %s\n') % (rel, bakname))
--- a/mercurial/merge.py Wed Aug 25 13:40:46 2010 +0200 +++ b/mercurial/merge.py Wed Aug 25 16:23:32 2010 +0200 @@ -282,7 +282,7 @@ # remove renamed files after safely stored for f in moves: - if util.lexists(repo.wjoin(f)): + if os.path.lexists(repo.wjoin(f)): repo.ui.debug("removing %s\n" % f) os.unlink(repo.wjoin(f)) @@ -320,7 +320,7 @@ else: merged += 1 util.set_flags(repo.wjoin(fd), 'l' in flags, 'x' in flags) - if f != fd and move and util.lexists(repo.wjoin(f)): + if f != fd and move and os.path.lexists(repo.wjoin(f)): repo.ui.debug("removing %s\n" % f) os.unlink(repo.wjoin(f)) elif m == "g": # get
--- a/mercurial/patch.py Wed Aug 25 13:40:46 2010 +0200 +++ b/mercurial/patch.py Wed Aug 25 16:23:32 2010 +0200 @@ -918,7 +918,7 @@ nulla = afile_orig == "/dev/null" nullb = bfile_orig == "/dev/null" abase, afile = pathstrip(afile_orig, strip) - gooda = not nulla and util.lexists(afile) + gooda = not nulla and os.path.lexists(afile) bbase, bfile = pathstrip(bfile_orig, strip) if afile == bfile: goodb = gooda
--- a/mercurial/util.py Wed Aug 25 13:40:46 2010 +0200 +++ b/mercurial/util.py Wed Aug 25 16:23:32 2010 +0200 @@ -431,15 +431,6 @@ return check -# os.path.lexists is not available on python2.3 -def lexists(filename): - "test whether a file with this name exists. does not follow symlinks" - try: - os.lstat(filename) - except: - return False - return True - def unlink(f): """unlink and remove the directory if it is empty""" os.unlink(f)