Mercurial > public > mercurial-scm > hg-stable
diff hgext/largefiles/overrides.py @ 17231:2446b63c89ec stable
largefiles: fix a traceback when addremove follows a remove (issue3507)
The problem only occurred if a file was removed with 'hg rm' (as opposed to the
OS utilities), and then addremove was run before a commit. Both normal and
large files were affected.
Ensuring that the file exists prior to an lstat() for size seems like the Right
Thing. But oddly enough, the missing file that was causing lstat() to blow up
was a standin when a largefile was removed, which seems fishy, because a standin
should never be added as a largefile. I was then able to get a standin added as
a largefile (whose name is 'large') with
hg addremove --config largefiles.patterns=**large
which also causes a backtrace. That will be fixed next.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 19 Jul 2012 11:12:05 -0400 |
parents | a6d9b2d33040 |
children | 25248e2ebaee |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Thu Jul 19 10:00:15 2012 -0400 +++ b/hgext/largefiles/overrides.py Thu Jul 19 11:12:05 2012 -0400 @@ -82,8 +82,15 @@ continue if exact or not exists: + wfile = repo.wjoin(f) + + # In case the file was removed previously, but not committed + # (issue3507) + if not os.path.exists(wfile): + continue + abovemin = (lfsize and - os.lstat(repo.wjoin(f)).st_size >= lfsize * 1024 * 1024) + os.lstat(wfile).st_size >= lfsize * 1024 * 1024) if large or abovemin or (lfmatcher and lfmatcher(f)): lfnames.append(f) if ui.verbose or not exact: