This is an archive of the discontinued Mercurial Phabricator instance.

remotefilelog-datapack: refactor createPack method to include pack directory
ClosedPublic

Authored by singhsrb on Nov 6 2017, 6:35 PM.
Tags
None
Subscribers

Details

Summary

createPack had no option to specify the pack directory because of
which it can only create one pack in a directory. This restriction was in place
because we only test the datapack and not the datapackstore during these tests.
This commit makes the method more generic and includes the option to specify
the directory for creating the packs. This would allow for the datapackstore to
be tested while reusing most of the current logic.

Test Plan

Ran all the tests.

Diff Detail

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

Event Timeline

singhsrb created this revision.Nov 6 2017, 6:35 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 6 2017, 6:35 PM
durham requested changes to this revision.Nov 7 2017, 1:29 PM
durham added a subscriber: durham.
durham added inline comments.
tests/remotefilelog-datapack.py
60

The normal pattern here would be to have createPack take an optional packDir argument. If that argument is None (the default) then we use makeTempDir. That way we don't have a plethora of functions for the variations on the same action. And we don't have to update any of the existing callers.

This revision now requires changes to proceed.Nov 7 2017, 1:29 PM
singhsrb added inline comments.Nov 7 2017, 1:52 PM
tests/remotefilelog-datapack.py
60

I actually did that and then did this for the following reasons:

  1. I wanted to have the packdir as the first argument. So, that would have meant refactoring the existing code anyways.
  2. After that change, createPack was doing too much for me.

I can change it to an optional argument.

singhsrb updated this revision to Diff 3321.Nov 7 2017, 2:10 PM
singhsrb marked an inline comment as done.Nov 7 2017, 8:24 PM
durham accepted this revision.Nov 7 2017, 8:28 PM
This revision is now accepted and ready to land.Nov 7 2017, 8:28 PM
This revision was automatically updated to reflect the committed changes.