-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
git move
: Add --exact
option (closes #176)
#450
git move
: Add --exact
option (closes #176)
#450
Conversation
4365291
to
e2f71d7
Compare
🤔 I could've sworn I commented on this already, but it looks like I forgot to press the big green submit button. This is still WIP, and the code is full of untold horrors that I need to go back through and rethink/clean up (and remove my local working commits, like adding It's been a long time since I've seriously thought about big O notation, so I'm hesitant to make any guesses about my Working on this w/ connected components vs my previous approach (that only considered semi-linear "ranges") turned up a bunch of interesting edge cases, many of them involving merge commits. I've tried to document some or all of them in tests, and they may need further attention as this PR solidifies. There are a few more edge cases that I need to code for (eg moving and inserting multiple components with various "non-stick" structures) but at this point I think I need to just dogfood it for a while to see how it feels and works, updating this as I do. Thank you! |
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.
Impressive work!
9982b28
to
d590b6a
Compare
Sorry for the false start and all of the WIP artifacts you had to wade through on this. I still consider this WIP pending some more dogfooding and proofreading, but I think I've addressed all of your initial comments. This has been a joy to use locally, but I have mostly been moving single commits. I haven't found myself moving multiple commits, ranges or "range trees" yet. I mean ... the tests say that it works, but I'll be interested in feedback on what happens IRL. 😄 |
I've been using this for a bit and I haven't noticed any issues so far. What do you say we merge it and fix any issues in follow-up commits?
I never answered this. I think both implementations are O(n^2) because you have one loop over the commits and a nested loop over the existing components to merge any intersecting components. You can do better with a data structure which can merge intersecting components efficiently (disjoint set), but otherwise I think you're likely to have O(n^2) complexity. Mostly we're hoping that we won't have to compute connected components for a large number of commits. If that happens, we can update it to use a better data structure in the future. |
This avoids a cycle error, and provides a convenient way to restack other sibling stacks onto the current stack via (for example) `git move -I -b @ -d 'parents(stack()) - stack()'`
d590b6a
to
4185a60
Compare
git move
: Add --range
and --exact
options (closes #176)git move
: Add --exact
option (closes #176)
4185a60
to
b86f7c7
Compare
b86f7c7
to
d60d51f
Compare
Thanks for the nudge. I've read through this again, pushed some clean up and I think it's good enough for now. A couple of notes on what I just pushed:
One thing that sticks out at me that I'd like to fix in a follow up is that I think the restriction to "only move components with 1 head" is lazy. I don't see any reason we can't graph RL
D --> C --> B --> A
F --> E --> B
classDef pink fill:#f9f;
class B,C,E pink;
I think that restriction predates the component approach and will be straightforward to support. I'll see what I can do. *cracks knuckles* |
[reopening #448]
Still a WIP, but seems to be working. I've rebased my work onto #447 (which is also WIP) and I'll update this as that PR develops. I'll probably add some more tests, too, as I wrote all of these w/ a pre-revset mindset, so I was only thinking about moving single ranges/commits.
Adds agit move --range <revset>
option to move ranges of commits.git move --exact <revset>
option (shorthand:-x
) to move single commits and/or ranges of commits.--insert
flag #400, Support revsets ingit move
#447 andgit move
: Add--range
and--exact
options (closes #176) #448