-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable one-directional sync #36
base: master
Are you sure you want to change the base?
Conversation
Any thoughts on this? I've been using it on my dev system since june without issue |
Hey! Yeah, I just haven't had a chance to take a look yet. I still use mirror daily, but have just been doing the bare minimum for features / project maintenance / etc. I'll take a look at your PR this week. Thanks for the ping! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Really my bad for taking so long to get to this.
Had a few questions about maybe using a proto-based enum to make sending encoding/decoding a little clearer, and potentially reusing / de-duplicating some of tests.
But overall looks great. Let me know what you think re my feedback; if you want to iterate on it, great; if not, I'll probably merge it anyway and maybe hack on the feedback at some point.
@@ -41,7 +41,7 @@ RUN install -d -m 777 /usr/local/var/run/watchman | |||
|
|||
WORKDIR "/opt/mirror" | |||
COPY --from=mirror-builder /tmp/mirror/mirror ./ | |||
COPY --from=mirror-builder /tmp/mirror/build/libs/mirror-all.jar ./ | |||
COPY --from=mirror-builder /tmp/mirror/build/libs/mirror.jar ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure these references are fixed in master; can you change back to the mirror-all
?
@@ -169,6 +169,9 @@ protected void runIfChecksOkay() { | |||
@Option(name = { "-li", "--use-internal-patterns" }, description = "use hardcoded include/excludes that generally work well for internal repos") | |||
public boolean useInternalPatterns; | |||
|
|||
@Option(name = { "-sd", "--sync-direction"}, description = "direction to sync files, defaults to \"BOTH\", allowed values: \"INBOUND\", \"OUTBOUND\", \"BOTH\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, so INBOUND
is from the perspective of the client, so means "download from server, but don't upload"? Wondering if something like FROM_SERVER
or TO_SERVER
would be clearer, but that sounds awkward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess once we get into the MirrorSession side of things, we do need something that is flippable/complement-able, as you're doing.
@@ -0,0 +1,59 @@ | |||
package mirror; | |||
|
|||
public enum SyncDirection { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protobuf supports enums:
https://developers.google.com/protocol-buffers/docs/proto#enum
If we put this enum in there, then you could just send the sync direction as-is over the wire, and not have to encode it/decode it as the separate allow inbound / allow outbound properties.
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.jooq.lambda.Seq.seq; | ||
|
||
public class UpdateTreeDiffInboundOnlyTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, thanks for these tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...that said, its fairly hard to tell what did/did not change between the regular / inbound / and outbound test cases.
I wonder if UpdateTreeDiffInboundOnlyTest
could extend UpdateTreeDiffTest
and then override the methods that are specifically different?
I've never really done that before (have one unit test extend another and selectively override tests) but I think? it should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't really sure which properties I was expecting to hold as I did this, so I was using this as a reference more than anything else. That said, you're right about trying to inherit from UpdateTreeDiffTest.
still a work in progress, the tests are probably not as complete as they should be, but this seems to be working for me, so I figure it's as good place a place as any to get some feedback.