In article <cafj3qw+sm2_d4a2elx1pjcphuwr4a_nh5+bvrx4cdf_ivva...@mail.gmail.com>
guillaume.brune...@gmail.com writes:
> Den ons 2 juni 2021 12:47Yasuhito FUTATSUKI <futat...@yf.bsdclub.org> skrev:
> 
> > Hello,
> >
> > In article <CAFJ3QWKkzdEXjkLB=g9R7uJRxXse+hCpcfru6Dza+AVo=
> > a-...@mail.gmail.com>
> > guillaume.brune...@gmail.com writes:
> >
> > > Hello,
> > >
> > > The command  svn log -r BASE:HEAD .  doesn't behave as I expect it to.
> > > According to svn help log:
> > >
> > >     Show the log messages for any incoming changes to foo.c during the
> > > next 'svn update':
> > >       svn log -r BASE:HEAD foo.c
> >
> > This help message seems innacurate.  'svn log -r BASE:HEAD' shows log
> > messages from "BASE" revision to "HEAD" revision on foo.c including
> > both revisions, where "BASE" is the revision number of an item in working
> > copy and "HEAD" is the latest(or "youngest") revision in the repository[1].
> >
> > [1] Version Control with Subversion (Nightly Build)
> >    Chapter 3. Advanced Topics > Revision Specifiers > Revision Keywords
> >
> > http://svnbook.red-bean.com/nightly/en/svn.tour.revs.specifiers.html#svn.tour.revs.keywords
> 
> 
> Ah, thank you, I guess the help message should be fixed then?

I have no idea about how accurate it should be in example section, and
I can't also propose how it should be because of my poor English
writing ability. However if you have some idea how it should be, please
make a draft (or patch against subversion/svn/svn.c).
 
> > Yet on my machine I have the following behavior:
> > >
> > >
> > > > svn up
> > > Updating '.':
> > > At revision 103730.
> > > > svn log -r BASE:HEAD .
> > > ------------------------------------------------------------------------
> > > r103730 | guillaumeb | 2021-06-01 09:35:24 +0200 (Tue, 01 Jun 2021) | 1
> > line
> > > some commit message
> > > ------------------------------------------------------------------------
> > > > svn up
> > > Updating '.':
> > > At revision 103730.
> > >
> > >
> > > So svn log -r BASE:HEAD reported a log message for a change that was
> > > already taken into account.
> > > Is that a bug in svn or am I misunderstanding something? I would have
> > > expected an empty result, given that there was no incoming change
> > > during the next svn up.
> >
> > In this case, both of "BASE" and "HEAD" revisions are 103730, so it
> > is equivalent to 'svn log -r 103730:103730', and in r103730, there
> > is some changes in '.'.  That is why it showed the log message.
> >
> 
> Is there another way to get what is described in the help message? To show
> the log messages for any incoming changes to foo.c during the next 'svn
> update'. This is exactly what I was trying to do.

One of obvious way is something like this (although this can't take
multiple target paths):
[[[
#!/bin/sh

# if This is not in your command search paths, please change it.
svn=svn

revision_base=`${svn} info -r BASE --show-item revision "$1"` || exit $?
revision_head=`${svn} info -r HEAD --show-item revision "$1"` || exit $?

# This check is needed to avoid "No such revision error" 
if test "${revision_base}" = "${revision_head}" ; then exit 0; fi

${svn} log -r $((${revision_base}+1)):HEAD --incremental "$1"
]]]

or if you allowe to be shown 'No such revision' error:
[[[
#!/bin/sh

# if This is not in your command search paths, please change it.
svn=svn

${svn} log -r $((`${svn} info -r BASE --show-item revision "$1"`+1)):HEAD \
    --incremental "$1"
]]]

or check the BASE revision number in advance and filter out the log
on its revision number from the result of 'svn log -r BASE:HEAD'.

In addition, to get "exactly" what you want, you need forbidding
everyone to commit change on the target path just after you examine
the HEAD revision until you run 'svn update', and I think it is not
good idea.

Cheers,
-- 
Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>

Reply via email to