diff mbox

support/downlaod: fix the Hg backend for tags

Message ID 1439933704-7451-1-git-send-email-yann.morin.1998@free.fr
State Accepted
Headers show

Commit Message

Yann E. MORIN Aug. 18, 2015, 9:35 p.m. UTC
When the version of a package is a Mercurial tag, the download fails,
with:
    abort: unknown revision 'X.Y.Z'!

This is because, in Mercurial, tags are commits like the others, and
when we clone, we actively request a tag. But then, the server
"dereferences" that tag and sends us the revision pointed to by that
tag. Of course, since the tag is a commit after the revision we got,
we do not have the revision adding the tag.

So, we just have to download the full repository to be sure we have
the tags in our local clone.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 support/download/hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnout Vandecappelle Aug. 22, 2015, 10:47 p.m. UTC | #1
[Putting our Mercurial expert in Cc]

On 08/18/2015 11:35 PM, Yann E. MORIN wrote:
> When the version of a package is a Mercurial tag, the download fails,
> with:
>     abort: unknown revision 'X.Y.Z'!
> 
> This is because, in Mercurial, tags are commits like the others, and
> when we clone, we actively request a tag. But then, the server
> "dereferences" that tag and sends us the revision pointed to by that
> tag. Of course, since the tag is a commit after the revision we got,
> we do not have the revision adding the tag.
> 
> So, we just have to download the full repository to be sure we have
> the tags in our local clone.
> 
> Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  support/download/hg | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/download/hg b/support/download/hg
> index d6654a1..ac1e9b9 100755
> --- a/support/download/hg
> +++ b/support/download/hg
> @@ -25,7 +25,7 @@ repo="${2}"
>  cset="${3}"
>  basename="${4}"
>  
> -${HG} clone ${verbose} --noupdate --rev "${cset}" "${repo}" "${basename}"
> +${HG} clone ${verbose} --noupdate "${repo}" "${basename}"
>  
>  ${HG} archive ${verbose} --repository "${basename}" --type tgz \
>                --prefix "${basename}" --rev "${cset}" \

 Wouldn't it be better to stick to the original way of cloning, and instead
specify the equivalent of HEAD as --rev here? I think that would even be the
default, no?

 Regards,
 Arnout

>
Yann E. MORIN Aug. 23, 2015, 9:05 a.m. UTC | #2
Arnout, All,

On 2015-08-23 00:47 +0200, Arnout Vandecappelle spake thusly:
> On 08/18/2015 11:35 PM, Yann E. MORIN wrote:
> > When the version of a package is a Mercurial tag, the download fails,
> > with:
> >     abort: unknown revision 'X.Y.Z'!
> > 
> > This is because, in Mercurial, tags are commits like the others, and
> > when we clone, we actively request a tag. But then, the server
> > "dereferences" that tag and sends us the revision pointed to by that
> > tag. Of course, since the tag is a commit after the revision we got,
> > we do not have the revision adding the tag.
> > 
> > So, we just have to download the full repository to be sure we have
> > the tags in our local clone.
> > 
> > Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > ---
> >  support/download/hg | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/support/download/hg b/support/download/hg
> > index d6654a1..ac1e9b9 100755
> > --- a/support/download/hg
> > +++ b/support/download/hg
> > @@ -25,7 +25,7 @@ repo="${2}"
> >  cset="${3}"
> >  basename="${4}"
> >  
> > -${HG} clone ${verbose} --noupdate --rev "${cset}" "${repo}" "${basename}"
> > +${HG} clone ${verbose} --noupdate "${repo}" "${basename}"
> >  
> >  ${HG} archive ${verbose} --repository "${basename}" --type tgz \
> >                --prefix "${basename}" --rev "${cset}" \
> 
>  Wouldn't it be better to stick to the original way of cloning, and instead
> specify the equivalent of HEAD as --rev here? I think that would even be the
> default, no?

That would be 'tip' in Mercurial parlance.

And yes, worth a try...

Regards,
Yann E. MORIN.
Yann E. MORIN Aug. 23, 2015, 9:29 a.m. UTC | #3
Arnout, All,

On 2015-08-23 00:47 +0200, Arnout Vandecappelle spake thusly:
> On 08/18/2015 11:35 PM, Yann E. MORIN wrote:
> > When the version of a package is a Mercurial tag, the download fails,
> > with:
> >     abort: unknown revision 'X.Y.Z'!
> > 
> > This is because, in Mercurial, tags are commits like the others, and
> > when we clone, we actively request a tag. But then, the server
> > "dereferences" that tag and sends us the revision pointed to by that
> > tag. Of course, since the tag is a commit after the revision we got,
> > we do not have the revision adding the tag.
> > 
> > So, we just have to download the full repository to be sure we have
> > the tags in our local clone.
> > 
> > Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > ---
> >  support/download/hg | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/support/download/hg b/support/download/hg
> > index d6654a1..ac1e9b9 100755
> > --- a/support/download/hg
> > +++ b/support/download/hg
> > @@ -25,7 +25,7 @@ repo="${2}"
> >  cset="${3}"
> >  basename="${4}"
> >  
> > -${HG} clone ${verbose} --noupdate --rev "${cset}" "${repo}" "${basename}"
> > +${HG} clone ${verbose} --noupdate "${repo}" "${basename}"
> >  
> >  ${HG} archive ${verbose} --repository "${basename}" --type tgz \
> >                --prefix "${basename}" --rev "${cset}" \
> 
>  Wouldn't it be better to stick to the original way of cloning, and instead
> specify the equivalent of HEAD as --rev here? I think that would even be the
> default, no?

OK, I tried using "--rev tip" and it does work.

There's a very slight difference when cloning eigen; they have a
.hgarchival.txt file that contains some info about the repo, and that
file slightly differs in both cases. Since it is a file generated by
Mercurial, and it is not in the repository, it's not a big problem.

Still, I think the cleanest is the patch I proposed.

Regards,
Yann E. MORIN.
Thomas Petazzoni Aug. 29, 2015, 9:45 a.m. UTC | #4
Dear Yann E. MORIN,

On Tue, 18 Aug 2015 23:35:04 +0200, Yann E. MORIN wrote:
> When the version of a package is a Mercurial tag, the download fails,
> with:
>     abort: unknown revision 'X.Y.Z'!
> 
> This is because, in Mercurial, tags are commits like the others, and
> when we clone, we actively request a tag. But then, the server
> "dereferences" that tag and sends us the revision pointed to by that
> tag. Of course, since the tag is a commit after the revision we got,
> we do not have the revision adding the tag.
> 
> So, we just have to download the full repository to be sure we have
> the tags in our local clone.
> 
> Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  support/download/hg | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to next, thanks (after fixing the minor typo in the commit
title). I've also committed a follow-up patch that makes the eigen
package use a Mercurial tag.

Thanks!

Thomas
diff mbox

Patch

diff --git a/support/download/hg b/support/download/hg
index d6654a1..ac1e9b9 100755
--- a/support/download/hg
+++ b/support/download/hg
@@ -25,7 +25,7 @@  repo="${2}"
 cset="${3}"
 basename="${4}"
 
-${HG} clone ${verbose} --noupdate --rev "${cset}" "${repo}" "${basename}"
+${HG} clone ${verbose} --noupdate "${repo}" "${basename}"
 
 ${HG} archive ${verbose} --repository "${basename}" --type tgz \
               --prefix "${basename}" --rev "${cset}" \