Show More
@@ -297,7 +297,7 b' def addremove(repo, pats=[], opts={}, dr' | |||||
297 | unknown.append(abs) |
|
297 | unknown.append(abs) | |
298 | if repo.ui.verbose or not exact: |
|
298 | if repo.ui.verbose or not exact: | |
299 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
|
299 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) | |
300 |
elif repo.dirstate[abs] != 'r' and (not good or not |
|
300 | elif repo.dirstate[abs] != 'r' and (not good or not os.path.lexists(target) | |
301 | or (os.path.isdir(target) and not os.path.islink(target))): |
|
301 | or (os.path.isdir(target) and not os.path.islink(target))): | |
302 | deleted.append(abs) |
|
302 | deleted.append(abs) | |
303 | if repo.ui.verbose or not exact: |
|
303 | if repo.ui.verbose or not exact: |
@@ -3166,7 +3166,7 b' def revert(ui, repo, *pats, **opts):' | |||||
3166 | target = repo.wjoin(abs) |
|
3166 | target = repo.wjoin(abs) | |
3167 | def handle(xlist, dobackup): |
|
3167 | def handle(xlist, dobackup): | |
3168 | xlist[0].append(abs) |
|
3168 | xlist[0].append(abs) | |
3169 |
if dobackup and not opts.get('no_backup') and |
|
3169 | if dobackup and not opts.get('no_backup') and os.path.lexists(target): | |
3170 | bakname = "%s.orig" % rel |
|
3170 | bakname = "%s.orig" % rel | |
3171 | ui.note(_('saving current version of %s as %s\n') % |
|
3171 | ui.note(_('saving current version of %s as %s\n') % | |
3172 | (rel, bakname)) |
|
3172 | (rel, bakname)) |
@@ -282,7 +282,7 b' def applyupdates(repo, action, wctx, mct' | |||||
282 |
|
282 | |||
283 | # remove renamed files after safely stored |
|
283 | # remove renamed files after safely stored | |
284 | for f in moves: |
|
284 | for f in moves: | |
285 |
if |
|
285 | if os.path.lexists(repo.wjoin(f)): | |
286 | repo.ui.debug("removing %s\n" % f) |
|
286 | repo.ui.debug("removing %s\n" % f) | |
287 | os.unlink(repo.wjoin(f)) |
|
287 | os.unlink(repo.wjoin(f)) | |
288 |
|
288 | |||
@@ -320,7 +320,7 b' def applyupdates(repo, action, wctx, mct' | |||||
320 | else: |
|
320 | else: | |
321 | merged += 1 |
|
321 | merged += 1 | |
322 | util.set_flags(repo.wjoin(fd), 'l' in flags, 'x' in flags) |
|
322 | util.set_flags(repo.wjoin(fd), 'l' in flags, 'x' in flags) | |
323 |
if f != fd and move and |
|
323 | if f != fd and move and os.path.lexists(repo.wjoin(f)): | |
324 | repo.ui.debug("removing %s\n" % f) |
|
324 | repo.ui.debug("removing %s\n" % f) | |
325 | os.unlink(repo.wjoin(f)) |
|
325 | os.unlink(repo.wjoin(f)) | |
326 | elif m == "g": # get |
|
326 | elif m == "g": # get |
@@ -918,7 +918,7 b' def selectfile(afile_orig, bfile_orig, h' | |||||
918 | nulla = afile_orig == "/dev/null" |
|
918 | nulla = afile_orig == "/dev/null" | |
919 | nullb = bfile_orig == "/dev/null" |
|
919 | nullb = bfile_orig == "/dev/null" | |
920 | abase, afile = pathstrip(afile_orig, strip) |
|
920 | abase, afile = pathstrip(afile_orig, strip) | |
921 |
gooda = not nulla and |
|
921 | gooda = not nulla and os.path.lexists(afile) | |
922 | bbase, bfile = pathstrip(bfile_orig, strip) |
|
922 | bbase, bfile = pathstrip(bfile_orig, strip) | |
923 | if afile == bfile: |
|
923 | if afile == bfile: | |
924 | goodb = gooda |
|
924 | goodb = gooda |
@@ -431,15 +431,6 b' def checksignature(func):' | |||||
431 |
|
431 | |||
432 | return check |
|
432 | return check | |
433 |
|
433 | |||
434 | # os.path.lexists is not available on python2.3 |
|
|||
435 | def lexists(filename): |
|
|||
436 | "test whether a file with this name exists. does not follow symlinks" |
|
|||
437 | try: |
|
|||
438 | os.lstat(filename) |
|
|||
439 | except: |
|
|||
440 | return False |
|
|||
441 | return True |
|
|||
442 |
|
||||
443 | def unlink(f): |
|
434 | def unlink(f): | |
444 | """unlink and remove the directory if it is empty""" |
|
435 | """unlink and remove the directory if it is empty""" | |
445 | os.unlink(f) |
|
436 | os.unlink(f) |
General Comments 0
You need to be logged in to leave comments.
Login now