This change is here to facilitate a future patch that is written in a
different file. I expect this module to grow a few different files.
Details
- Reviewers
kevincox - Group Reviewers
hg-reviewers - Commits
- rHGd3b5cbe311d9: rust-dirstate: create dirstate submodule
rHGcc1cdce1eea2: rust-dirstate: create dirstate submodule
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
rust/hg-core/src/dirstate/mod.rs | ||
---|---|---|
7 | If 1 and 2 are the best names why not just make it pub struct DirstateParetens([&[u8]; 2])? | |
8 | It seems odd that this struct is public seeing as it is just a bag of bytes. Would it make sense to keep this internal to the parser/serializer? | |
rust/hg-core/src/dirstate/parsers.rs | ||
41 | It seems to me that this code would be simpler if you constructed a single cursor at the top of the function and just used it to track your state instead of having a couple of other variables to track it. |
rust/hg-core/src/dirstate/mod.rs | ||
---|---|---|
7 | I feel that accessing parents.p1 is more semantic and less noisy than parents.0[0]. Also doing DirstateParents([ b"12345678910111213141", b"00000000000000000000", ]); is not miles clearer than DirstateParents { p1: b"12345678910111213141", p2: b"00000000000000000000", }; | |
8 | This is public so that hg-cpython can use it. I think it helps with readability too, a "bag of bytes" is sometimes not really helpful when stumbling on code. |
rust/hg-core/src/dirstate/mod.rs | ||
---|---|---|
8 | I guess the point I am trying to make is why do we pass around this "half-parsed" object. Why can't the public API go straight from bytes -> fully parsed. |
rust/hg-core/src/dirstate/mod.rs | ||
---|---|---|
8 | The current Python public API expects parents as return value and does mutate-on-parse for other in-memory objects. Sorry if I'm missing something obvious. |
rust/hg-core/src/dirstate/mod.rs | ||
---|---|---|
8 | Ok, I'm still not convinced this is the best API to expose but if it is a public API I guess it can't be changed. |
rust/hg-core/src/dirstate/mod.rs | ||
---|---|---|
8 | Yup. I've rebased this change. |
rust/hg-core/src/dirstate/mod.rs | ||
---|---|---|
8 |
@kevincox, I haven't followed the discussion here and I don't know much about rust. I'll queue this patch based on your review. If you had any more comments, those can be addressed in a follow-up patch. |
If 1 and 2 are the best names why not just make it pub struct DirstateParetens([&[u8]; 2])?