-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add some support for staging/unstaging individual hunks #104
Comments
I'm massively in favour of this :) I don't have the time to build this myself, but if you fancy putting up a PR, I will support you as best I can. |
Great! At least you're in favour.
It's very difficult: for small repositories, a viable approach might be to create a transient git repository and use the index there! I have been vaguely thinking about a Mercurial plugin that:
That's basically what the git index does (except that git accounts for the index in all of its commands). That would allow monky to "manage the index patch hunk-by-hunk", which feels possible, but still leverage Mercurial for This is not something I can seriously pursue at this time, but I'll circle back to it occasionally as I can. Perhaps something will be possible. |
I'm using 'hg commit --interactive' for now. Hunk commits would be very useful, even on a single file level. |
This probably isn't interesting to many people, but: I just shelved a commit that started experimenting with this with the commit message:
I'll keep poking at my |
@ncalexan Did you ever discuss this with the mercurial developers/existing extension writers? |
It seems much more mercurial-ish to me to make commit and amend it (possibly many times) before pushing, not to work on defining what is staged before committing. So instead of working on patch, I would simply commit straight away whatever user selected, then apply further actions by amending this commit. |
Regarding „selected changes commit”, it probably makes sense to look at how TortoiseHG does that. See here, especially fragments with (mayhaps devs could be persuaded to move this or similar feature to core mercurial or to publish this extension as independent tool, looks like thing which various GUIs would use) |
Besides the above comments by Mekk |
Right now, Monky is file-centric: staging and unstaging works at the level of files. Historically, this is appropriate: most Mercurial commands filter by files. But newer Mercurial commands support "interactive" modes which operate at finer grains: hunk by hunk and line by line. What can we do to support this in Monky? I expect this to be very technically intricate, but worth discussing.
Under the hood, Mercurial's interactive operations are managing patch files. There's no magic here, other than that they apply the patches slightly different than
hg patch
does. Monky could, with effort, manage staged and unstaged hunks. It would be challenging to accommodate true git-style staging, but even that might be possible with a little Mercurial extension magic and in-memory diffing.So suppose we aimed lower: could we teach Monky to handle staged and unstaged hunks and drop everything on the floor in the case that the status buffer is refreshed? (And ignore changes to the working directory behind Monky's back.) Right now staging a file refreshes the status buffer, but that's for convenience rather than a real requirement (and is bad for performance, especially in large repositories).
I'm also experimenting with work-flows that use, say,
ediff
to apply hunks in sequence before runninghg patch
, etc.The text was updated successfully, but these errors were encountered: