Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I add git hashes to my Eclipse RCP application About page?
    primarykey
    data
    text
    <p>In the past, using mercurial with Visual Studio, I used to <a href="https://stackoverflow.com/q/2386440/42473">add mercurial changeset ids to my application</a> so that when the user did a Help About, it would list all components and their <em>exact</em> mercurial revision. It would also log all changeset ids to the application log file every time it started up. This procedure even allowed me to see whether a particular working copy had been modified since the last commit (mercurial's <code>hg id</code> indicates a dirty working copy by adding a + to the end of the changeset id it reports).</p> <p>This was incredibly useful, since it meant that any time a user reported a problem, I could quickly build <em>exactly</em> the revision they were using. I could also tell when people had snuck in a <em>quick hack</em> to fix a problem and had neither committed the changes nor told me about it.</p> <p>I would now like to replicate the same facility in my <code>git</code> hosted RCP application. Unfortunately, I'm rather new to both <code>git</code> and Eclipse RCP application development, so I'm a little unclear as whether the same technique would work.</p> <p>In particular I have been unable to work out how to do the equivalent of <code>hg id</code> with <code>git</code> , how to get the Eclipse build system to call <code>git</code> to create a <code>.gitignore</code>d file containing the id, so that it can be compiled into the application/plug-in, or how to get this information into the Help>About page.</p> <p>If you have done this, or something similar, I would love some pointers as to how you did it. Alternatively, I would be happy to hear any suggestions about alternative ways to achieve the end result that I seek.</p> <hr> <p>With a little google-fu, reading behind the lines and experimentation, it looks like <code>git rev-parse HEAD</code> or <code>git rev-parse --short HEAD</code> is probably the closest to an <code>hg id</code>, alas I can't find a way to indicate that the working copy isn't clean, so it looks like I will have to check the output of a <code>git status --short</code> and if it isn't empty, append a <code>+</code> to the commit hash manually.</p> <p>Now I just need to understand how to get these commands to be run from the Eclipse build system and where to inject this information so that it shows up in the About pages.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload