Submitter | phabricator |
---|---|
Date | Sept. 17, 2019, 10:58 p.m. |
Message ID | <differential-rev-PHID-DREV-ezoeavzqzm4q425cewqk-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/41707/ |
State | Superseded |
Headers | show |
Comments
durin42 added a comment. I feel like there's room for doing better, but it'll require very careful reasoning and may not be worthwhile. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6867/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6867 To: spectral, #hg-reviewers Cc: durin42, mercurial-devel
Patch
diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -54,6 +54,10 @@ checkambig = checkambigfiles and (f, '') in checkambigfiles try: fp = opener(f, 'a', checkambig=checkambig) + if fp.tell() < o: + raise error.Abort(_( + "attempted to truncate %s to %d bytes, but it was " + "already %d bytes\n") % (f, o, fp.tell())) fp.truncate(o) fp.close() except IOError: