ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Versionnumbers
@ 2001-07-10 15:30 Hokojoku, Bert
  2001-07-10 15:55 ` Versionnumbers Frans Goddijn
  2001-07-10 16:34 ` Versionnumbers Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Hokojoku, Bert @ 2001-07-10 15:30 UTC (permalink / raw)


Hi all,
I'm trying to keep track of the versions of my documents. Is it possible to
print the number of times a file has been generated in a title or a header?
Or, is there some other way to generate versionnumbers?

Hope you can help, 

Regards from a cloudy Amsterdam,

B E R T

                        __   __
                      .'  '.'  `.
                   _.-|  o | o   |-._
                 .~   `.__.'.__.'^   ~.
               .~     ^  /   \  ^      ~.
               \-._^   ^|     |     ^_.-/
               `\  `-._  \___/ ^_.-'  /'
                 `\_   `--...--'   _/'
                    `-.._     _..-'
                        /     \    Bert Hokojoku
                      .'^   ^ `.     \ \/ /
                    .'    ^     ^`._.'^  ;
                  .' ^ .    ^   .^  .' ./
                  /    /        ^\'.__.'
                 |  ^ /|   ^     |


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

* Re: Versionnumbers
  2001-07-10 15:30 Versionnumbers Hokojoku, Bert
@ 2001-07-10 15:55 ` Frans Goddijn
  2001-07-11 21:03   ` Versionnumbers Hartmut Henkel
  2001-07-10 16:34 ` Versionnumbers Hans Hagen
  1 sibling, 1 reply; 6+ messages in thread
From: Frans Goddijn @ 2001-07-10 15:55 UTC (permalink / raw)


I think a current-date/time/seconds line in basic TeX code would
do that unless you compile several times per second ;-)))

> I'm trying to keep track of the versions of my documents. Is it
possible to
> print the number of times a file has been generated in a title
or a header?
> Or, is there some other way to generate versionnumbers?


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

* Re: Versionnumbers
  2001-07-10 15:30 Versionnumbers Hokojoku, Bert
  2001-07-10 15:55 ` Versionnumbers Frans Goddijn
@ 2001-07-10 16:34 ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2001-07-10 16:34 UTC (permalink / raw)
  Cc: 'ntg-context@ntg.nl'

At 05:30 PM 7/10/01 +0200, Hokojoku, Bert wrote:
>Hi all,
>I'm trying to keep track of the versions of my documents. Is it possible to
>print the number of times a file has been generated in a title or a header?
>Or, is there some other way to generate versionnumbers?

you can use 

  \version[concept]  % \versie[concept]

or 

  \version[temporary] % \versie[voorlopig]

which provides some info about the project structure [if used]

If you want to keep track of numbers in an independent way, the best way is 

\def\LoadVariable#1#2%
  {\startreadingfile
   \readlocfile{#2}{}{}%
   \ifx#1\undefined\global\let#1\empty\fi
   \stopreadingfile}

\def\SaveVariable#1#2%
  {\immediate\openout\scratchwrite=#2%
   \immediate\write\scratchwrite{\string\gdef\string#1{#1}}%
   \immediate\closeout\scratchwrite}

\newcounter\CurrentVersionNumber

\def\IncrementVersionNumber%
  {\LoadVariable{\CurrentVersionNumber}{version.num}%
   \doglobal\increment\CurrentVersionNumber
   \SaveVariable{\CurrentVersionNumber}{version.num}}

\IncrementVersionNumber versie: \CurrentVersionNumber

[let's hope that this makes it into teh archive since i'll probably loose it]

Hans

-------------------------------------------------------------------------
                                  Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: Versionnumbers
  2001-07-10 15:55 ` Versionnumbers Frans Goddijn
@ 2001-07-11 21:03   ` Hartmut Henkel
  2001-07-12  7:17     ` Versionnumbers Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Hartmut Henkel @ 2001-07-11 21:03 UTC (permalink / raw)
  Cc: ntg-context

You might use `rcs', revision control system. This stamps your files
with an Id string, containing filename, -version, -date, creator...

You submit e. g. the file foo.tex by ci foo.tex. You get the new version
for editing by typing co -l foo.tex

In plain TeX the following macro scans the Id string, when you have
initially included a line \scanrcs $Id$ into your input file:

% begin of file foo.tex
\def\scanrcs $#1 #2,v #3 #4/#5/#6 #7 #8 #9 ${%
  \def\fileversion{#3}
  \def\filedate{#4#5#6} % Or whatever date format you like
  }

\scanrcs $Id: foo.tex,v 1.1 2001/07/11 20:49:46 hahe Exp hahe $

\fileversion
\bye
% end of file foo.tex

E. g. this prints `1.1', the current version. 

Should be transferable also to ConTeXt, but don't have experience with
it.

Have fun!

Hartmut

On Tue, 10 Jul 2001, Frans Goddijn wrote:

> I think a current-date/time/seconds line in basic TeX code would
> do that unless you compile several times per second ;-)))
> 
> I'm trying to keep track of the versions of my documents. Is it
> possible to print the number of times a file has been generated in a
> title or a header?
> Or, is there some other way to generate versionnumbers?

------------------------------------------------------------------------
Dr.-Ing. Hartmut Henkel
In den Auwiesen 6, D-68723 Oftersheim, Germany
E-Mail: hartmut_henkel@gmx.de
http://www.circuitwizard.de
------------------------------------------------------------------------


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

* Re: Versionnumbers
  2001-07-11 21:03   ` Versionnumbers Hartmut Henkel
@ 2001-07-12  7:17     ` Hans Hagen
  2001-07-12 19:00       ` Versionnumbers Hartmut Henkel
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2001-07-12  7:17 UTC (permalink / raw)
  Cc: ntg-context

At 11:03 PM 7/11/01 +0200, Hartmut Henkel wrote:
>You might use `rcs', revision control system. This stamps your files
>with an Id string, containing filename, -version, -date, creator...
>
>You submit e. g. the file foo.tex by ci foo.tex. You get the new version
>for editing by typing co -l foo.tex
>
>In plain TeX the following macro scans the Id string, when you have
>initially included a line \scanrcs $Id$ into your input file:
>
>% begin of file foo.tex
>\def\scanrcs $#1 #2,v #3 #4/#5/#6 #7 #8 #9 ${%
>  \def\fileversion{#3}
>  \def\filedate{#4#5#6} % Or whatever date format you like
>  }
>
>\scanrcs $Id: foo.tex,v 1.1 2001/07/11 20:49:46 hahe Exp hahe $
>
>\fileversion
>\bye
>% end of file foo.tex
>
>E. g. this prints `1.1', the current version. 
>
>Should be transferable also to ConTeXt, but don't have experience with
>it.

Where is this line put? At the top of a file? In a separate file? In
principle reading such a line could be automated [i.e. hooked into \starttext]

Hans

-------------------------------------------------------------------------
                                  Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: Versionnumbers
  2001-07-12  7:17     ` Versionnumbers Hans Hagen
@ 2001-07-12 19:00       ` Hartmut Henkel
  0 siblings, 0 replies; 6+ messages in thread
From: Hartmut Henkel @ 2001-07-12 19:00 UTC (permalink / raw)
  Cc: ntg-context

You can put the macro call \scanrcs $Id$ into the source file whereever
you like, but regarding TeX, the \scanrcs macro has to be defined
before.

At the first time when you submit the file by ci, the string $Id$ will
be replaced by the expanded string (still delimited by `$Id' and `$')
with date, version number, etc. inbetween. Obviously only from that
moment on the simple macro below is working, because it expects the full
number of macro parameters.

The rcs system (consisting of programs ci, co, rlog...) itself does not
care where or how often it finds a string $Id$ or the expanded version
in a file. It simply replaces all occurences by updated, identical ones.
These strings need not be at file or line begin. E. g. you can simply
write %$Id$ to keep the string away from TeX.

There are other strings detected by rcs, like $Log$, $Revision$,
$Author$, $Date$ etc., which mostly produce substrings of the full $Id$
string. See the co man-pages.

There should exist also a LaTeX package for handling rcs, but I never
used it, since it is fun writing three lines of macro and seeing TeX
running over it :-)

I forgot: ci produces a repository file `,v', e.g. foo.tex,v, which
incrementally keeps ALL versions: The latest version is stored
literally, and older versions are stored incrementally as differences.
The automatic version number incrementing uses diff to detect file
changes. If you create a subdirectory `RCS' in the current directory,
repository files are kept there. The really good point about rcs is,
that you can recover any older file version by version number.

There is also the cvs system around, which puts a layer of functionality
on top of rcs, and allows managing repositories over the Internet.

Best Regards

Hartmut

On Thu, 12 Jul 2001, Hans Hagen wrote:

> At 11:03 PM 7/11/01 +0200, Hartmut Henkel wrote:
> >You might use `rcs', revision control system. This stamps your files
> >with an Id string, containing filename, -version, -date, creator...
> >
> >You submit e. g. the file foo.tex by ci foo.tex. You get the new version
> >for editing by typing co -l foo.tex
> >
> >In plain TeX the following macro scans the Id string, when you have
> >initially included a line \scanrcs $Id$ into your input file:
> >
> >% begin of file foo.tex
> >\def\scanrcs $#1 #2,v #3 #4/#5/#6 #7 #8 #9 ${%
> >  \def\fileversion{#3}
> >  \def\filedate{#4#5#6} % Or whatever date format you like
> >  }
> >
> >\scanrcs $Id: foo.tex,v 1.1 2001/07/11 20:49:46 hahe Exp hahe $
> >
> >\fileversion
> >\bye
> >% end of file foo.tex
> >
> >E. g. this prints `1.1', the current version. 
> >
> >Should be transferable also to ConTeXt, but don't have experience with
> >it.
> 
> Where is this line put? At the top of a file? In a separate file? In
> principle reading such a line could be automated [i.e. hooked into \starttext]
> 
> Hans

------------------------------------------------------------------------
Dr.-Ing. Hartmut Henkel
In den Auwiesen 6, D-68723 Oftersheim, Germany
E-Mail: hartmut_henkel@gmx.de
http://www.circuitwizard.de
------------------------------------------------------------------------


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

end of thread, other threads:[~2001-07-12 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-10 15:30 Versionnumbers Hokojoku, Bert
2001-07-10 15:55 ` Versionnumbers Frans Goddijn
2001-07-11 21:03   ` Versionnumbers Hartmut Henkel
2001-07-12  7:17     ` Versionnumbers Hans Hagen
2001-07-12 19:00       ` Versionnumbers Hartmut Henkel
2001-07-10 16:34 ` Versionnumbers Hans Hagen

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).