# HG changeset patch # User Mads Kiilerich # Date 1358289010 -3600 # Node ID 03442135dff426805380fa57e25d017c87b46f0c # Parent bafbfe0b450cb80f688d7b62d6a5a7dc16a86614 refactoring: use unlinkpath with ignoremissing diff -r bafbfe0b450c -r 03442135dff4 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Tue Jan 15 23:30:10 2013 +0100 +++ b/hgext/largefiles/overrides.py Tue Jan 15 23:30:10 2013 +0100 @@ -170,8 +170,7 @@ # are removing the file. if getattr(repo, "_isaddremove", False): ui.status(_('removing %s\n') % f) - if os.path.exists(repo.wjoin(f)): - util.unlinkpath(repo.wjoin(f)) + util.unlinkpath(repo.wjoin(f), ignoremissing=True) lfdirstate.remove(f) lfdirstate.write() forget = [lfutil.standin(f) for f in forget] diff -r bafbfe0b450c -r 03442135dff4 hgext/rebase.py --- a/hgext/rebase.py Tue Jan 15 23:30:10 2013 +0100 +++ b/hgext/rebase.py Tue Jan 15 23:30:10 2013 +0100 @@ -319,8 +319,7 @@ clearstatus(repo) ui.note(_("rebase completed\n")) - if os.path.exists(repo.sjoin('undo')): - util.unlinkpath(repo.sjoin('undo')) + util.unlinkpath(repo.sjoin('undo'), ignoremissing=True) if skipped: ui.note(_("%d revisions have been skipped\n") % len(skipped)) @@ -508,8 +507,7 @@ def clearstatus(repo): 'Remove the status files' - if os.path.exists(repo.join("rebasestate")): - util.unlinkpath(repo.join("rebasestate")) + util.unlinkpath(repo.join("rebasestate"), ignoremissing=True) def restorestatus(repo): 'Restore a previously stored status' diff -r bafbfe0b450c -r 03442135dff4 mercurial/commands.py --- a/mercurial/commands.py Tue Jan 15 23:30:10 2013 +0100 +++ b/mercurial/commands.py Tue Jan 15 23:30:10 2013 +0100 @@ -2947,8 +2947,8 @@ wlock.release() # remove state when we complete successfully - if not opts.get('dry_run') and os.path.exists(repo.join('graftstate')): - util.unlinkpath(repo.join('graftstate')) + if not opts.get('dry_run'): + util.unlinkpath(repo.join('graftstate'), ignoremissing=True) return 0