-
-
Notifications
You must be signed in to change notification settings - Fork 151
feat: Implement mercurial (hg) adapter #255
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
Conversation
|
I think it would make more sense to move the implementation of |
c96ba2b to
3b3e9f3
Compare
|
@sindrets I'll test this for a while to cover all the corner cases. I noticed that hg is quite a bit slower in generating the file history information: on a repo of ~50K commits it takes about 15 to 20 seconds to list 256 commits. Since hg is a python script, each invocation to the command takes a performance hit when it starts the python interpreter. There are some options to improve it: for example there is a experimental For maximum compatibility, I will keep the default How would you prefer handling the docs? |
|
@zegervdv Great work!
Ouch, that's pretty bad 😅. Does the history size matter for the performance when you're only querying
This sounds interesting. If hg has a daemon like you describe, it sounds like the appropriate way to use it in a third party tool like this where we are making up to hundreds of calls to the VCS. But I also agree that it shouldn't be a blocker to get this PR merged. Just something to explore for the future.
For the commands, we can just have one section of options for each VCS tool. I'll push a commit where I've started to amend the docs to show what I mean, and then you can just fill it out with descriptions of the different options you've implemented :) |
|
@zegervdv If you would like to, I'll make you a collaborator on the project after we've merged this. That way you can more effectively maintain the hg part of the code when you have time :) |
|
I did a couple of tests on different repos and it seems the total number of commits in the repo is not a (huge) factor. The limitation to 256 works, I can see the counter increment as they come in and setting it to a lower value also confirms that I get the right number of lines.
Yes, the vscode plugin for mercurial has it as an optional feature, so I'm not sure how easy/stable it is. Definitively if the new sapling-scm also has it and would become a new major player. Thanks for the reviews, there are so many features in this plugin I haven't even discovered them all, let alone had a chance to use them :)
That would be nice, thanks for the trust :) |
Co-authored-by: Sindre T. Strøm <sindrets@gmail.com>
sindrets
left a comment
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.
This line should probably have an added condition of:
if --[[ ... ]] and self.adapter:instanceof(GitAdapter.__get()) thenThis PR seems almost good to go! If you address the few things I mentioned here, I think I'd be ready to merge :)
|
Fixed the last comments. I think it is ready :) |
sindrets
left a comment
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.
LGTM, let's get this merged!
|
@zegervdv I've also sent you an invite to become a collaborator on the project :) |
|
Thanks! |
Current status:
This PR includes a couple of fixes and refactors and adds a new hierarchy to the config (splitting options between hg and git).
I will create a separate PR for these soon, so they can be merged in first with the necessary deprecation logic and migration documentation. Those commits are not the intended focus of this PR.
I already wanted to open this one to ask some questions about the implementation.
As stated above, I have the file history and basic diffview working for mercurial repos, but I'm running into an issue when encountering a merge-conflicted file.
In git there is a single command (created via
GitAdapter:get_namestat_args) which lists both modified and conflicted files.For mercurial, these are two separate commands (
hg status -mardandhg resolve --list).I'm still looking for a command or combination of options that might give me the same result from a single command, but chances are it is not possible.
So, I propose to make a second job with a second args command, e.g.
VCSAdapter:get_unresolved_args. If this returnsnil, like will be the case for git, the job will not run and all remains the same as it is now.If it does return a list of arguments, it will run and the results of both jobs (namestat and unresolved) is merged and parsed as if it was a single command.
Does that sound like a reasonable approach or do you know a better/cleaner way?