Skip to content
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

Support working on a Git repository with hg-git #532

Merged
merged 15 commits into from
Jul 13, 2021

Conversation

paugier
Copy link
Contributor

@paugier paugier commented Mar 16, 2021

Mercurial can be used as a Git client with hg-git. Then, one would like to get the same version as with Git (in particular, with Git sha). I tried to implement that in this PR. It's an early draft without tests!

This PR fixes #530.

@RonnyPfannschmidt
Copy link
Contributor

thanks for attempting this,
as it seems like you needed to barge into the git impl of the workdir i wonder if this is something we should provide more generic so that the hg one can be used as a base in general

i think it would be a improvement for the hg one not to get confused between tags and bookmarks in general, so it may be a better variant to jsut add a test for hg to make it stop confusing branches and tags

@paugier
Copy link
Contributor Author

paugier commented Mar 16, 2021

Yes, I see that I can actually simplify and clean up quite a bit the code...

@paugier
Copy link
Contributor Author

paugier commented Mar 18, 2021

I did a quite big refactoring. I still need to add some tests for hg-git but I guess a first review could be useful.

Also, I hope there are no PR more advanced that this one that modify a lot hg.py and git.py, because rebasing/merging could be a pain.

@paugier
Copy link
Contributor Author

paugier commented Mar 18, 2021

Regarding the confusion between tags and bookmarks in general, I think it is mainly related to people using hg-git.

hg-git adds some tags corresponding to remote Git branches (which explain this message #235 (comment)). In standard Mercurial, we don't have that.

Copy link
Contributor

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just took a quick skim on mobile and I like what i see

I'll give it a deeper dig in the evening

Don't worry about the prs, the only one related has to be redone to begin with


class Workdir:
def __init__(self, path):
require_command(self.COMMAND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the command is used only at a few specified places,

If the requirement is checked in the named constructors, it may not be necessary to explicitly handle certain details

@paugier
Copy link
Contributor Author

paugier commented Mar 18, 2021

I'm not super familiar with pytest fixtures. For the tests, I need to create first a Git repo (as in the wd fixture in test_git.py) and then a Mercurial repo by cloning the Git repo. I can't find a good way to do that with fixtures. Do you know how it should be done?

@RonnyPfannschmidt
Copy link
Contributor

@paugier the creation of such a fixture certainly is a bit of a pita, its something thats a bit boggling for myself as well

i'll take a night of sleep and hopefully have a reasonable suggestion tommorow

@RonnyPfannschmidt
Copy link
Contributor

i still didn't come up with a good way, it may be ok to just make a small repo that exposes the issues and putting it into a tarball to extract in a test until the api is actually better

@paugier
Copy link
Contributor Author

paugier commented Mar 23, 2021

I found a solution which works at home. Now hg-git needs to be installed for the CI. But actually, I didn't find how hg is installed.

@RonnyPfannschmidt
Copy link
Contributor

mercurial was just installed with the base image,
if there is no simple way to install it, i'm fine with having the tests xfail on ci and testing them locally until we figure a good way to test against hg/hg-git

@paugier
Copy link
Contributor Author

paugier commented Mar 24, 2021

It should be sufficient to run something like (here for Linux)

$(hg debuginstall --template "{pythonexe}") -m pip install hg-git --user

I don't know the equivalent for Windows but this shouldn't be difficult.

Then, we need to put in a .hgrc

[extensions]
hggit =

but this can be done in the test.

@RonnyPfannschmidt
Copy link
Contributor

that would break in a number of setups, lets add a extra step/requirement to prevent bad failure

@RonnyPfannschmidt
Copy link
Contributor

based on https://foss.heptapod.net/mercurial/hg-git im under the impression its ok to do the pip install command on the ci setup setup

a end-user facing solution is still necessary

@paugier
Copy link
Contributor Author

paugier commented Mar 25, 2021

I don't understand why the CI runs were not triggered after my last push...

a end-user facing solution is still necessary

This code will be used only for end users working with a Mercurial repository containing a directory .hg/git with the default path pointing towards a Git repository. Should I also add a condition to use it only if hg-git is importable by the python used by Mercurial?

For setuptools_scm developers, the test will be skip if hggit is not installed.

@RonnyPfannschmidt
Copy link
Contributor

please add the condition, also sorry for the delays, im currently pretty stretched with personal time

@paugier
Copy link
Contributor Author

paugier commented Jun 25, 2021

please add the condition

Hum, sorry but I don't get it. Which condition?

@RonnyPfannschmidt
Copy link
Contributor

from your question earlier

Should I also add a condition to use it only if hg-git is importable by the python used by Mercurial?

@paugier
Copy link
Contributor Author

paugier commented Jul 6, 2021

I added the condition (see https://github.com/pypa/setuptools_scm/pull/532/files#diff-74f525775c1b35086b22582997e4b7397cefd5f484d373c039e3b3a0cd39fa92R4) and merged main into this branch. Locally, all tests pass.

@paugier
Copy link
Contributor Author

paugier commented Jul 13, 2021

I see that there are "2 workflows awaiting approval". Can this be tried ?

Moreover, this PR might finally be ready to be merged :-)

@RonnyPfannschmidt
Copy link
Contributor

wow, hg-git is a hell to install on the linux actions :/

@RonnyPfannschmidt
Copy link
Contributor

thanks for your patience and preservance

@paugier
Copy link
Contributor Author

paugier commented Jul 13, 2021

Oh finally, it's all green! And as expected the hg-git test passes on Ubuntu and is skipped on Windows!

@RonnyPfannschmidt
Copy link
Contributor

do you want to rebase/squash anything or can i merge ? :)

@paugier
Copy link
Contributor Author

paugier commented Jul 13, 2021

I'm fine with putting all that mess in the main branch! I was told that small commits are good :-)

Thanks for you patience on this PR!

@RonnyPfannschmidt RonnyPfannschmidt merged commit 087c32b into pypa:main Jul 13, 2021
@RonnyPfannschmidt
Copy link
Contributor

Thanks for sticking trough this long winded process :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AssertionError: Can't parse version default/fix/fluidsim-core-0.4.1
2 participants