Page MenuHomePhabricator

basestore: remove unnecessary files with suffix '_old' during clean up

Authored by singhsrb on Dec 1 2017, 1:27 PM.



There is no logic in place right now to delete the files with suffix
'_old' which are created solely for debugging purposes in addremotefilelognode
method. There is no need to keep these files around if a corresponding file
without the '_old' doesn't exist. Therefore, this commit removes such files if
they are no longer required. This also allows for more robust deletion of the
directories during the clean up because sometimes they contain only the files
with '_old' suffix.

Test Plan
  • Ran all the tests.
  • Tested that the files with '_old' suffix are removed during hg repack --incremental on a sample repo.

Diff Detail

rFBHGX Facebook Mercurial Extensions
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

singhsrb created this revision.Dec 1 2017, 1:27 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptDec 1 2017, 1:27 PM
quark accepted this revision.Dec 1 2017, 2:18 PM
quark added a subscriber: quark.
quark added inline comments.

You can use mercurial.util.tryunlink(filepath) here.

This revision is now accepted and ready to land.Dec 1 2017, 2:18 PM
singhsrb added inline comments.Dec 1 2017, 2:19 PM

cool! I will surely use that :).

singhsrb updated this revision to Diff 4061.Dec 1 2017, 2:37 PM
This revision was automatically updated to reflect the committed changes.