ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Module for svn info
@ 2008-01-21 23:58 Robin Kirkham
  2008-01-22  3:10 ` Ernesto Schirmacher
  0 siblings, 1 reply; 9+ messages in thread
From: Robin Kirkham @ 2008-01-21 23:58 UTC (permalink / raw)
  To: ntg-context

Hi Markus,

If your sources are in svn, then they actually have the same svn- 
number, after a commit. But the numbers in the $Revision$ or $Id$ tags  
of your working copies are not updated by svn commit. However, if you  
do an "svn update" after the commit, it should update the numbers. So,  
you shouldn't need to work out the maximum value.

Here, we actually use the output of the "svnversion" command, save it  
automatically it in a file, and include it in the document. This way,  
the version number indicates if the document came from checked-in  
sources, modified sources, or mixed revisions. We don't have a module  
to do it, just a

     svnversion > svnversion.tex ; texexec document.tex

in the Makefile, and on the document front page somewhere

     \doiffileelse{svnversion.tex}{
        Subversion revision
        \ignorespaces \input svnversion\relax \removeunwantedspaces . 
\crlf
     }{}

Cheers,

Robin

> Hi Aditya,
>
> thanks for your reply. It's a good starting point.
>
> One thing is missing in this solution.
>
> Our documents are structured into several files.
> Every file has an svn-version. So I want to
> calculate the max version.
>
> Do you know a small example where a max value
> is calculated. I would try to integrate it into
> the other example.
>
> Kind regards,
> Markus
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Module for svn info
  2008-01-21 23:58 Module for svn info Robin Kirkham
@ 2008-01-22  3:10 ` Ernesto Schirmacher
  2008-01-22 11:15   ` Markus Bernhardt
  0 siblings, 1 reply; 9+ messages in thread
From: Ernesto Schirmacher @ 2008-01-22  3:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users


>  If your sources are in svn, then they actually have the same svn- 
> number, after a commit. But the numbers in the $Revision$ or $Id$ tags  
> of your working copies are not updated by svn commit. However, if you  
> do an "svn update" after the commit, it should update the numbers. So,  
> you shouldn't need to work out the maximum value.

The svn keyword Revision or Rev or LastChangedRevision (they are all 
the same) are defined as the last revision where the file changed (see 
subversion book chapter 3 section keyword substitution).  It seems to 
me that subversion does not have a global keyword that would give you
the last revision number.  But they do provide svnversion to get that 
number automatically (see subversion book highlighted box named
"Where's $GlobalRev$?").   So Robin's solution below seems to be the
best way to get the global version number.

> 
>      svnversion> svnversion.tex ; texexec document.tex
> 
> in the Makefile, and on the document front page somewhere
> 
>      \doiffileelse{svnversion.tex}{
>         Subversion revision
>         \ignorespaces \input svnversion\relax \removeunwantedspaces . 
> \crlf
>      }{}
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Module for svn info
  2008-01-22  3:10 ` Ernesto Schirmacher
@ 2008-01-22 11:15   ` Markus Bernhardt
  2008-01-23 12:34     ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Bernhardt @ 2008-01-22 11:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users, ernesto_schirmacher

[-- Attachment #1: Type: text/plain, Size: 2988 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ernesto,
hi Robin,

thanks for your replies.

The thing I like most with your solution is that svnversion provides a
modify flag, so I can see whether all changes have been cheched in. Great.

A little drawback is that all files under the current path are used to
determine the version. If theres a file in the path which is not part
of the document changes to this file will also change the revision of
the document. But I think this can be easily prevented by placing
every document into an own directory.

What do you think of using:

\def\SVNVERSION{svnversion -n > svnversion.tex}

\ifeof18
    \installprogram{\SVNVERSION}%
\else
    \executesystemcommand{\SVNVERSION}%
\fi

Kind regards,
Markus


Ernesto Schirmacher schrieb:
>> If your sources are in svn, then they actually have the same svn-
>>  number, after a commit. But the numbers in the $Revision$ or
>> $Id$ tags of your working copies are not updated by svn commit.
>> However, if you do an "svn update" after the commit, it should
>> update the numbers.

This is not true. The complete name of $Rev§$ is
$LastChangedRevision$. It's the revision of the last change to this file.


>> So, you shouldn't need to work out the maximum value.
>
> The svn keyword Revision or Rev or LastChangedRevision (they are
> all the same) are defined as the last revision where the file
> changed (see subversion book chapter 3 section keyword
> substitution).  It seems to me that subversion does not have a
> global keyword that would give you the last revision number.
There can be no useful global last revision number, because
it always depends on the used URL.

> But they do provide svnversion to get that number automatically
> (see subversion book highlighted box named "Where's $GlobalRev$?").
> So Robin's solution below seems to be the best way to get the
> global version number.
>
>> svnversion> svnversion.tex ; texexec document.tex
>>
>> in the Makefile, and on the document front page somewhere
>>
>> \doiffileelse{svnversion.tex}{ Subversion revision \ignorespaces
>> \input svnversion\relax \removeunwantedspaces . \crlf }{}
> ___________________________________________________________________________________
>  If your question is of interest to others as well, please add an
> entry to the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context webpage  :
> http://www.pragma-ade.nl / http://tex.aanhet.net archive  :
> https://foundry.supelec.fr/projects/contextrev/ wiki     :
> http://contextgarden.net
> ___________________________________________________________________________________
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHldA9dnooMonJSYkRAggwAJ9pNN8yoJR5rIvdahf4eJo0sTp5kQCfUqOR
EVoOQluHh+9LhNRKTJDIFo8=
=il3n
-----END PGP SIGNATURE-----


[-- Attachment #2: Markus_Bernhardt.vcf --]
[-- Type: text/x-vcard, Size: 558 bytes --]

begin:vcard
fn:Markus Bernhardt
n:Bernhardt;Markus
org:Software Consulting Markus Bernhardt GmbH
adr;quoted-printable:;;Spieljochstr. 34;M=C3=BCnchen;;81825;Germany
email;internet:Markus.Bernhardt@scmb.de
title;quoted-printable:Gesch=C3=A4ftsf=C3=BChrer
tel;work:+49-89-420903-0
tel;fax:+49-89-420903-20
tel;home:+40-90-18932799
tel;cell:+49-171-5770462
note;quoted-printable:Gesch=C3=A4ftsf=C3=BChrung Markus Bernhardt=0D=0A=
	Handelsregister AG M=C3=BCnchen HRB 125966=0D=0A=
	USt-Id DE201885231
x-mozilla-html:FALSE
url:www.scmb.de
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Module for svn info
  2008-01-22 11:15   ` Markus Bernhardt
@ 2008-01-23 12:34     ` Aditya Mahajan
  0 siblings, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2008-01-23 12:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 22 Jan 2008, Markus Bernhardt wrote:

> \def\SVNVERSION{svnversion -n > svnversion.tex}
>
> \ifeof18
>    \installprogram{\SVNVERSION}%
> \else
>    \executesystemcommand{\SVNVERSION}%
> \fi

Looks ok to me. Coming back to calculating the maximum of versions, this 
is possible to do inside TeX. Here is a short proof of concept. We need a 
two pass mechanism since revisions could be defined after they need to be 
used.

\unprotect
\def\REVISION#1
   {\doifdefinedelse{!!REVISION}
     {\ifdim#1pt > \dimexpr1pt*\!!REVISION
      \edef\!!REVISION{#1} \fi}
     {\edef\!!REVISION{#1}}}

\definetwopasslist{REVISION}

% Execute this in the beginning of document
\def\initializeREVISION
   {\gettwopassdata{REVISION}
    \iftwopassdatafound
      \xdef\getREVISION{\twopassdata}
     \else
       \def\getREVISION{Not Found}
     \fi
     \global\let\initializeREVISION\relax}

% Execute this at the end of document
\def\saveREVISION
   {\savetwopassdata {REVISION} {\getREVISION} {\!!REVISION}}

\appendtoks \initializeREVISION \to \everystarttext
\appendtoks \saveREVISION       \to \everystoptext

\protect

\starttext

File 1:\REVISION{10} \getREVISION

File 2:\REVISION{4} \getREVISION

File 3:\REVISION{14} \getREVISION

\stoptext

Now this just needs to be plugged into the command to get revision 
information from svn tags.

Aditya

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Module for svn info
  2008-01-23 11:52 ` Robin Kirkham
@ 2008-01-23 21:26   ` Peter Münster
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Münster @ 2008-01-23 21:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Jan 23 2008, Robin Kirkham wrote:
> 
>     What do you think of using:
> 
>     \def\SVNVERSION{svnversion -n > svnversion.tex}

Hello Robin,

The "-n" option does not change anything, see also
http://archive.contextgarden.net/thread/20060228.155539.6a630df2.en.html
and
http://wiki.contextgarden.net/How_TeX_reads_input

Cheers, Peter

-- 
http://pmrb.free.fr/contact/

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Module for svn info
       [not found] <mailman.3280.1201040714.4317.ntg-context@ntg.nl>
@ 2008-01-23 11:52 ` Robin Kirkham
  2008-01-23 21:26   ` Peter Münster
  0 siblings, 1 reply; 9+ messages in thread
From: Robin Kirkham @ 2008-01-23 11:52 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2107 bytes --]

> Hi Ernesto,
> hi Robin,
>
> thanks for your replies.
>
> The thing I like most with your solution is that svnversion provides a
> modify flag, so I can see whether all changes have been cheched in.  
> Great.
>
> A little drawback is that all files under the current path are used to
> determine the version. If theres a file in the path which is not part
> of the document changes to this file will also change the revision of
> the document. But I think this can be easily prevented by placing
> every document into an own directory.
>
> What do you think of using:
>
> \def\SVNVERSION{svnversion -n > svnversion.tex}
>
> \ifeof18
>     \installprogram{\SVNVERSION}%
> \else
>     \executesystemcommand{\SVNVERSION}%
> \fi

That is nicer of course ... I just do it outside the document in a  
Makefile because I'm used to doing that sort of thing.

I imagine the only uncompromised way to extract an svn revision (or  
revision range) that covers the whole document accurately is to write  
a script that extracts the source file names from the previous  
logfile (or somewhere), individually determines their revision using  
"svn status" (to get modified status), and constructs an overall  
result. I guess some embedded Lua could do that pretty easily and  
portably. It would also catch files that are often outside the  
immediate document directory (in particular, bib files).

> Ernesto Schirmacher schrieb:
>>> If your sources are in svn, then they actually have the same svn-
>>>  number, after a commit. But the numbers in the $Revision$ or
>>> $Id$ tags of your working copies are not updated by svn commit.
>>> However, if you do an "svn update" after the commit, it should
>>> update the numbers.
>
> This is not true. The complete name of $Rev§$ is
> $LastChangedRevision$. It's the revision of the last change to this  
> file.

Quite right, my apologies. An "svn update" does however alter the  
output of "svnversion", for instance if it indicates a mixed revision  
(1234:3456), after an update it will be just 3456.

Best,

Robin

[-- Attachment #1.2: Type: text/html, Size: 7259 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Module for svn info
  2008-01-20  5:11 ` Aditya Mahajan
@ 2008-01-21  8:32   ` Markus Bernhardt
  0 siblings, 0 replies; 9+ messages in thread
From: Markus Bernhardt @ 2008-01-21  8:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Aditya,

thanks for your reply. It's a good starting point.

One thing is missing in this solution.

Our documents are structured into several files.
Every file has an svn-version. So I want to
calculate the max version.

Do you know a small example where a max value
is calculated. I would try to integrate it into
the other example.

Kind regards,
Markus

Aditya Mahajan schrieb:
> On Sun, 20 Jan 2008, Markus Bernhardt wrote:
>
>> is there a module to access subversion tags in context documents (like
>> svninfo or svnkw for latex).
>
> There is no package, but it is not difficult to create one. For example
> see,
>
> http://archive.contextgarden.net/message/20070920.231549.347dc370.en.html
>
> Aditya
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry
to the Wiki!
>
> maillist : ntg-context@ntg.nl /
http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


- --

Mit freundlichen Grüßen

Markus Bernhardt

Software Consulting
Markus Bernhardt GmbH
Spieljochstr. 34
81825 München   

Fon: +49-89-420903-0
Fax: +49-89-420903-20
www: http://www.scmb.de  

Geschäftsführung Markus Bernhardt
Handelsregister AG München HRB 125966
USt-Id DE201885231

PGP: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89C94989
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHlFi2dnooMonJSYkRAkCmAJ49x2fpvg6LaSUq3WIhIYRs8GGLlACfX+4j
rBbb544ejlgOSkMuGmzQWuw=
=nvBr
-----END PGP SIGNATURE-----


[-- Attachment #2: Markus_Bernhardt.vcf --]
[-- Type: text/x-vcard, Size: 558 bytes --]

begin:vcard
fn:Markus Bernhardt
n:Bernhardt;Markus
org:Software Consulting Markus Bernhardt GmbH
adr;quoted-printable:;;Spieljochstr. 34;M=C3=BCnchen;;81825;Germany
email;internet:Markus.Bernhardt@scmb.de
title;quoted-printable:Gesch=C3=A4ftsf=C3=BChrer
tel;work:+49-89-420903-0
tel;fax:+49-89-420903-20
tel;home:+40-90-18932799
tel;cell:+49-171-5770462
note;quoted-printable:Gesch=C3=A4ftsf=C3=BChrung Markus Bernhardt=0D=0A=
	Handelsregister AG M=C3=BCnchen HRB 125966=0D=0A=
	USt-Id DE201885231
x-mozilla-html:FALSE
url:www.scmb.de
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Module for svn info
  2008-01-20  2:34 Markus Bernhardt
@ 2008-01-20  5:11 ` Aditya Mahajan
  2008-01-21  8:32   ` Markus Bernhardt
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2008-01-20  5:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 20 Jan 2008, Markus Bernhardt wrote:

> is there a module to access subversion tags in context documents (like
> svninfo or svnkw for latex).

There is no package, but it is not difficult to create one. For example 
see,

http://archive.contextgarden.net/message/20070920.231549.347dc370.en.html

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Module for svn info
@ 2008-01-20  2:34 Markus Bernhardt
  2008-01-20  5:11 ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Bernhardt @ 2008-01-20  2:34 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

is there a module to access subversion tags in context documents (like
svninfo or svnkw for latex).

Kind regards,
Markus

- --

Mit freundlichen Grüßen

Markus Bernhardt

Software Consulting
Markus Bernhardt GmbH
Spieljochstr. 34  
81825 München     

Fon: +49-89-420903-0
Fax: +49-89-420903-20
www: http://www.scmb.de    

Geschäftsführung Markus Bernhardt
Handelsregister AG München HRB 125966
USt-Id DE201885231

PGP: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89C94989
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHkrMrdnooMonJSYkRAugkAJ92g2uZQO5LmpjLLS0q9MqZxS4eBACgnlfP
TrJpQ5rKQt/fplaNbLg8B5M=
=9KnS
-----END PGP SIGNATURE-----


[-- Attachment #2: Markus_Bernhardt.vcf --]
[-- Type: text/x-vcard, Size: 558 bytes --]

begin:vcard
fn:Markus Bernhardt
n:Bernhardt;Markus
org:Software Consulting Markus Bernhardt GmbH
adr;quoted-printable:;;Spieljochstr. 34;M=C3=BCnchen;;81825;Germany
email;internet:Markus.Bernhardt@scmb.de
title;quoted-printable:Gesch=C3=A4ftsf=C3=BChrer
tel;work:+49-89-420903-0
tel;fax:+49-89-420903-20
tel;home:+40-90-18932799
tel;cell:+49-171-5770462
note;quoted-printable:Gesch=C3=A4ftsf=C3=BChrung Markus Bernhardt=0D=0A=
	Handelsregister AG M=C3=BCnchen HRB 125966=0D=0A=
	USt-Id DE201885231
x-mozilla-html:FALSE
url:www.scmb.de
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-01-23 21:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-21 23:58 Module for svn info Robin Kirkham
2008-01-22  3:10 ` Ernesto Schirmacher
2008-01-22 11:15   ` Markus Bernhardt
2008-01-23 12:34     ` Aditya Mahajan
     [not found] <mailman.3280.1201040714.4317.ntg-context@ntg.nl>
2008-01-23 11:52 ` Robin Kirkham
2008-01-23 21:26   ` Peter Münster
  -- strict thread matches above, loose matches on Subject: below --
2008-01-20  2:34 Markus Bernhardt
2008-01-20  5:11 ` Aditya Mahajan
2008-01-21  8:32   ` Markus Bernhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).