* emacs-repository-version not defined when cloned with mercurial
@ 2019-08-09 15:40 Uwe Brauer
2019-08-09 20:24 ` Paul Eggert
0 siblings, 1 reply; 12+ messages in thread
From: Uwe Brauer @ 2019-08-09 15:40 UTC (permalink / raw)
To: emacs-devel
Hi
I cloned the emacs repository with mercurial and compiled it as I always
do with
./configure --prefix=/opt/emacs27 --with-x-toolkit=athena --with-mailutils
But then emacs-repository-version returned till.
Any change to tell emacs to use the mercurial hash tag?
Regards
Uwe Brauer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-09 15:40 emacs-repository-version not defined when cloned with mercurial Uwe Brauer
@ 2019-08-09 20:24 ` Paul Eggert
2019-08-10 7:52 ` Sven Joachim
2019-08-10 8:29 ` Uwe Brauer
0 siblings, 2 replies; 12+ messages in thread
From: Paul Eggert @ 2019-08-09 20:24 UTC (permalink / raw)
To: emacs-devel
On 8/9/19 8:40 AM, Uwe Brauer wrote:
> Any change to tell emacs to use the mercurial hash tag?
Sorry, it's not clear what you're asking for here. If you'd like to
write and debug the feature it sounds like it'd be a good thing to add
to Emacs, though I wouldn't expect it to appear unless a Mercurial-using
developer takes the initiative to develop it since it should be needed
only by developers of Emacs.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-09 20:24 ` Paul Eggert
@ 2019-08-10 7:52 ` Sven Joachim
2019-08-10 8:35 ` Uwe Brauer
2019-08-10 8:29 ` Uwe Brauer
1 sibling, 1 reply; 12+ messages in thread
From: Sven Joachim @ 2019-08-10 7:52 UTC (permalink / raw)
To: emacs-devel
On 2019-08-09 13:24 -0700, Paul Eggert wrote:
> On 8/9/19 8:40 AM, Uwe Brauer wrote:
>> Any change to tell emacs to use the mercurial hash tag?
>
> Sorry, it's not clear what you're asking for here. If you'd like to
> write and debug the feature it sounds like it'd be a good thing to add
> to Emacs, though I wouldn't expect it to appear unless a
> Mercurial-using developer takes the initiative to develop it since it
> should be needed only by developers of Emacs.
It might actually be a bit confusing to them if mercurial revision IDs
are included in bug reports, since those do not exist in the git
repository. And I have not found a way to get the original git SHA1
back, at least it is not reported in "hg log --debug".
Cheers,
Sven
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-09 20:24 ` Paul Eggert
2019-08-10 7:52 ` Sven Joachim
@ 2019-08-10 8:29 ` Uwe Brauer
2019-08-10 9:17 ` Stefan Monnier
1 sibling, 1 reply; 12+ messages in thread
From: Uwe Brauer @ 2019-08-10 8:29 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]
>>> "PE" == Paul Eggert <eggert@cs.ucla.edu> writes:
> On 8/9/19 8:40 AM, Uwe Brauer wrote:
>> Any change to tell emacs to use the mercurial hash tag?
> Sorry, it's not clear what you're asking for here. If you'd like to
> write and debug the feature it sounds like it'd be a good thing to add
> to Emacs, though I wouldn't expect it to appear unless a
> Mercurial-using developer takes the initiative to develop it since it
> should be needed only by developers of Emacs.
I know mercurial reasonably well (but I am not a mercurial developer). I
am compiling and running the GNU emacs from the git repository.
As I said I cloned it to mercurial using the git plugin.
This plugin translate the git and the mercurial hash with out problem.
I looked now in the relevant code in version.el
It goes as follows:
#+begin_src elisp :noexport
(defun emacs-repository-version-git (dir)
"Ask git itself for the version information for directory DIR."
(message "Waiting for git...")
(with-temp-buffer
(let ((default-directory (file-name-as-directory dir)))
(and (eq 0
(with-demoted-errors "Error running git rev-parse: %S"
(call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
(progn (goto-char (point-min))
(looking-at "[0-9a-fA-F]\\{40\\}"))
(match-string 0)))))
(defun emacs-repository-get-version (&optional dir external)
"Try to return as a string the repository revision of the Emacs sources.
The format of the returned string is dependent on the VCS in use.
Value is nil if the sources do not seem to be under version
control, or if we could not determine the revision. Note that
this reports on the current state of the sources, which may not
correspond to the running Emacs.
Optional argument DIR is a directory to use instead of `source-directory'.
Optional argument EXTERNAL is ignored."
(emacs-repository-version-git (or dir source-directory)))
#+end_src
The git command
git rev-parse HEAD
corresponds to the mercurial command
hg parent --template '{node}\n'
I will try to implement the relevant
emacs-repository-version-hg
Command. Not sure what to do with emacs-repository-get-version though.
Maybe I should define a new variable
emacs-use-hg
Which per default is nil.
Not sure
Uwe Brauer
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 7:52 ` Sven Joachim
@ 2019-08-10 8:35 ` Uwe Brauer
0 siblings, 0 replies; 12+ messages in thread
From: Uwe Brauer @ 2019-08-10 8:35 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 999 bytes --]
>>> "SJ" == Sven Joachim <svenjoac@gmx.de> writes:
> On 2019-08-09 13:24 -0700, Paul Eggert wrote:
>> On 8/9/19 8:40 AM, Uwe Brauer wrote:
>>> Any change to tell emacs to use the mercurial hash tag?
>>
>> Sorry, it's not clear what you're asking for here. If you'd like to
>> write and debug the feature it sounds like it'd be a good thing to add
>> to Emacs, though I wouldn't expect it to appear unless a
>> Mercurial-using developer takes the initiative to develop it since it
>> should be needed only by developers of Emacs.
> It might actually be a bit confusing to them if mercurial revision IDs
> are included in bug reports, since those do not exist in the git
> repository. And I have not found a way to get the original git SHA1
> back, at least it is not reported in "hg log --debug".
This is possible
1. Short hash: log -r shortHGhash --template '{gitnode|short}\n'
2. Long hash: log -r shortHGhash --template '{gitnode}\n'
Uwe Brauer
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 8:29 ` Uwe Brauer
@ 2019-08-10 9:17 ` Stefan Monnier
2019-08-10 9:54 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2019-08-10 9:17 UTC (permalink / raw)
To: emacs-devel; +Cc: Uwe Brauer
> Command. Not sure what to do with emacs-repository-get-version though.
> Maybe I should define a new variable
>
> emacs-use-hg
>
> Which per default is nil.
I think catching an error signaled by `git` and then trying `hg` instead
is a better plan.
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 9:17 ` Stefan Monnier
@ 2019-08-10 9:54 ` Eli Zaretskii
2019-08-10 10:09 ` Uwe Brauer
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2019-08-10 9:54 UTC (permalink / raw)
To: Stefan Monnier; +Cc: oub, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sat, 10 Aug 2019 05:17:15 -0400
> Cc: Uwe Brauer <oub@mat.ucm.es>
>
> > Command. Not sure what to do with emacs-repository-get-version though.
> > Maybe I should define a new variable
> >
> > emacs-use-hg
> >
> > Which per default is nil.
>
> I think catching an error signaled by `git` and then trying `hg` instead
> is a better plan.
Why not simply ask users who clone into a Mercurial repository to hack
up a 'git' shell script that will do what Emacs expects using
Mercurial? I mean, this is an unusual situation which we don't have
to support too actively. The hash is only important when reporting
bugs. I find the idea of trying yet another shell command, which
might not exist exactly like the first one, just to support such
unusual use cases, a bit gross for my liking.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 9:54 ` Eli Zaretskii
@ 2019-08-10 10:09 ` Uwe Brauer
2019-08-10 10:44 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Uwe Brauer @ 2019-08-10 10:09 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 3417 bytes --]
>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>> From: Stefan Monnier <monnier@iro.umontreal.ca>
>> Date: Sat, 10 Aug 2019 05:17:15 -0400
>> Cc: Uwe Brauer <oub@mat.ucm.es>
>>
>> > Command. Not sure what to do with emacs-repository-get-version though.
>> > Maybe I should define a new variable
>> >
>> > emacs-use-hg
>> >
>> > Which per default is nil.
>>
>> I think catching an error signaled by `git` and then trying `hg` instead
>> is a better plan.
> Why not simply ask users who clone into a Mercurial repository to hack
> up a 'git' shell script that will do what Emacs expects using
> Mercurial? I mean, this is an unusual situation which we don't have
> to support too actively. The hash is only important when reporting
> bugs.
I am not sure I understand your proposal.
I am currently compiling GNU emacs for a commit which
corresponds to the git hash
1d75604eaded6a8482d28d57bc8e6a4d99d5caee
In my mercurial clone this is hash
48e6ea8e6e9f08075949468971312b4c607eb291
Mercurial can without problems translate between both hashes.
However suppose I run the compiled version for a while (and suppose I
even have deleted the cloned mercurial repository) and want to
report a bug, then I don't know for which mercurial I compiled that
version, and I cannot calculate the corresponding git hash.
This is why I try to have a function which would tell me the mercurial
hash.
What is your proposal?
I have to admit that I don't understand who currently emacs is
calculating the git hash.
I see that it uses shell command
git rev-parse HEAD
But where and for which repository.
How can I debug emacs-repository-version?
I am asking this, since my generalization for mercurial did not work
(defun emacs-repository-version-hg (dir)
"Ask git itself for the version information for directory DIR."
(message "Waiting for git...")
(with-temp-buffer
(let ((default-directory (file-name-as-directory dir)))
(and (eq 0
(with-demoted-errors "Error running hg parent --template: %S"
(call-process "hg" nil '(t nil) nil "parent" "--template '{node}\n'")))
(progn (goto-char (point-min))
(looking-at "[0-9a-fA-F]\\{40\\}"))
(match-string 0)))))
(defun emacs-repository-version-git (dir)
"Ask git itself for the version information for directory DIR."
(message "Waiting for git...")
(with-temp-buffer
(let ((default-directory (file-name-as-directory dir)))
(and (eq 0
(with-demoted-errors "Error running git rev-parse: %S"
(call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
(progn (goto-char (point-min))
(looking-at "[0-9a-fA-F]\\{40\\}"))
(match-string 0)))))
(defun emacs-repository-get-version (&optional dir external)
"Try to return as a string the repository revision of the Emacs sources.
The format of the returned string is dependent on the VCS in use.
Value is nil if the sources do not seem to be under version
control, or if we could not determine the revision. Note that
this reports on the current state of the sources, which may not
correspond to the running Emacs.
Optional argument DIR is a directory to use instead of `source-directory'.
Optional argument EXTERNAL is ignored."
(emacs-repository-version-hg (or dir source-directory)))
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 10:09 ` Uwe Brauer
@ 2019-08-10 10:44 ` Eli Zaretskii
2019-08-10 13:12 ` Uwe Brauer
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2019-08-10 10:44 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-devel
> From: Uwe Brauer <oub@mat.ucm.es>
> Date: Sat, 10 Aug 2019 12:09:55 +0200
>
> > Why not simply ask users who clone into a Mercurial repository to hack
> > up a 'git' shell script that will do what Emacs expects using
> > Mercurial? I mean, this is an unusual situation which we don't have
> > to support too actively. The hash is only important when reporting
> > bugs.
>
> I am not sure I understand your proposal.
The prop[osal is to have a script called 'git' which would call hg to
return the Git hash of a repository cloned with hg. Then Emacs will
get what it wants what it calls "git rev-parse".
> Mercurial can without problems translate between both hashes.
>
> However suppose I run the compiled version for a while (and suppose I
> even have deleted the cloned mercurial repository) and want to
> report a bug, then I don't know for which mercurial I compiled that
> version, and I cannot calculate the corresponding git hash.
AFAIR, the hash is computed when Emacs is built, and is recorded in
the built Emacs. It cannot be calculated after the build.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 10:44 ` Eli Zaretskii
@ 2019-08-10 13:12 ` Uwe Brauer
2019-08-10 13:33 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Uwe Brauer @ 2019-08-10 13:12 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2031 bytes --]
> The prop[osal is to have
Sorry I am still confused. Do I understand that correctly
> a script called 'git' which would call hg to
> return the Git hash of a repository cloned with hg.
1. You want a (shell) script called git, although there is an
executable called git?
> Then Emacs will
> get what it wants what it calls "git rev-parse".
2. I don't see how, as I said
git rev-parse HEAD == hg parent --template '{node}\n'
so even with the «definition»
alias git "hg parent --template '{node}\n'"
would not work.
I am sure I misunderstood you, but I would appreciate any clarification
> AFAIR, the hash is computed when Emacs is built, and is recorded in
> the built Emacs. It cannot be calculated after the build.
That makes a lot of sense.
It think I know where is my mistake, however I am not sure how to solve
it.
The git command to obtain the hash is as I said
git rev-parse HEAD
And it is implemented as
(call-process "git" nil '(t nil) nil "rev-parse" "HEAD")
and when I execute the call in the git repository it gives me the
correct hash.
The mercurial command is a bit more complicated
hg parents --template '{node}\n'
(And maybe the ' cause some problem.
I used
(call-process "hg" nil '(t nil) nil "parent" "--template '{node}\n'")
but when I execute (via M-:) then it does not give the correct answer.
It gives
hg parents [-r REV] [FILE]
show the parents of the working directory or revision (DEPRECATED)
options:
-r --rev REV show parents of the specified revision
-T --template TEMPLATE display with template
--mq operate on patch repository
(use 'hg parents -h' to show more help)
Which is clear sign that not all the parameters were passed correctly.
Could somebody please tell me how the
call
hg parents --template '{node}\n'
Is correctly translated to the
call-process
Thanks
Uwe Brauer
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 13:12 ` Uwe Brauer
@ 2019-08-10 13:33 ` Eli Zaretskii
2019-08-10 13:58 ` Uwe Brauer
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2019-08-10 13:33 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-devel
> From: Uwe Brauer <oub@mat.ucm.es>
> Date: Sat, 10 Aug 2019 15:12:18 +0200
>
> I used
> (call-process "hg" nil '(t nil) nil "parent" "--template '{node}\n'")
>
> but when I execute (via M-:) then it does not give the correct answer.
> It gives
>
> hg parents [-r REV] [FILE]
>
> show the parents of the working directory or revision (DEPRECATED)
>
> options:
>
> -r --rev REV show parents of the specified revision
> -T --template TEMPLATE display with template
> --mq operate on patch repository
>
> (use 'hg parents -h' to show more help)
>
> Which is clear sign that not all the parameters were passed correctly.
You need to make each command-line argument a separate string, I
think:
(call-process "hg" nil '(t nil) nil "parents" "--template" "{node}\n")
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs-repository-version not defined when cloned with mercurial
2019-08-10 13:33 ` Eli Zaretskii
@ 2019-08-10 13:58 ` Uwe Brauer
0 siblings, 0 replies; 12+ messages in thread
From: Uwe Brauer @ 2019-08-10 13:58 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
> You need to make each command-line argument a separate string, I
> think:
> (call-process "hg" nil '(t nil) nil "parents" "--template" "{node}\n")
Ah, thanks very much: now it works as expected.
I am not sure how to proceed. I could send a patch, but from the
discussion I got the impression that it might not be needed since it is
a rare corner case.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-08-10 13:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-09 15:40 emacs-repository-version not defined when cloned with mercurial Uwe Brauer
2019-08-09 20:24 ` Paul Eggert
2019-08-10 7:52 ` Sven Joachim
2019-08-10 8:35 ` Uwe Brauer
2019-08-10 8:29 ` Uwe Brauer
2019-08-10 9:17 ` Stefan Monnier
2019-08-10 9:54 ` Eli Zaretskii
2019-08-10 10:09 ` Uwe Brauer
2019-08-10 10:44 ` Eli Zaretskii
2019-08-10 13:12 ` Uwe Brauer
2019-08-10 13:33 ` Eli Zaretskii
2019-08-10 13:58 ` Uwe Brauer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.