You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Sunil Shetye <sh...@bombay.retortsoft.com> on 2004/11/23 08:28:59 UTC

tagging just a few files

I require to tag some files (spread over many directories) from the
repository for tracking changes in those files over time. subversion
does not seem to have a simple way of doing so. All methods of doing
so are either cumbersome or incorrect. Is it possible to add an option
like "--parents" to "svn copy" to ease tagging of specific files?

Here is a sample layout of my repository:

include/
include/Makefile
include/b.h
lib/
lib/Makefile
lib/a.c
lib/b.c
src/
src/Makefile
src/c.c

Suppose, I have give a tag "test" to:

include/Makefile
lib/Makefile
lib/a.c

=====================================================================
Method 1:
svn mkdir $REPOS/tags/test -m 'dir for tag test'
svn cp include/Makefile lib/Makefile lib/a.c $REPOS/tags/test -m 'created tag test'

PROBLEM: filenames are clashing; layout is not maintained.
=====================================================================

=====================================================================
Method 2:
svn mkdir $REPOS/tags/test -m 'dir for tag test'
svn mkdir $REPOS/tags/test/include $REPOS/tags/test/lib -m 'created tag test'
svn cp include/Makefile $REPOS/tags/test/include -m 'created tag test'
svn cp lib/Makefile lib/a.c $REPOS/tags/test/lib -m 'created tag test'

PROBLEM: extra "svn mkdir" is expensive; too many identical log
messages.
=====================================================================

=====================================================================
Method 3:
svn cp . $REPOS/tags/test -m 'created tag test'
svn rm $REPOS/tags/test/include/b.h $REPOS/tags/test/lib/b.c $REPOS/tags/test/src -m 'created tag test'

PROBLEM: finding out what to remove is not trivial; remove list could
be much longer than original list.
=====================================================================

=====================================================================
Desired Method:
svn cp include/Makefile lib/Makefile lib/a.c $REPOS/tags/test --parents -m 'created tag test'
=====================================================================

Any support for this wishlist?

Any help will be appreciated.

-- 
Sunil Shetye.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Benjamin Pflugmann <be...@pflugmann.de>.
On Wed 2004-12-01 at 12:02:17 +0530, Sunil Shetye wrote:
> Quoting from Benjamin Pflugmann's mail on Mon, Nov 29, 2004 at 01:18:56PM +0100:
> > On Sat 2004-11-27 at 13:08:15 +0530, Sunil Shetye wrote:
> > [...]
> > > > a good start would to post a more specific explanation of
> > > > how such a feature would work, as from the descriptions I read up to
> > > > now, I am not clear what exactly --parents is meant to do.
> > > 
> > > The option is meant to be similar to the --parents option in cp(1).
> > 
> > What if you specify URLs as source?
> 
> Equivalently, how do you use --parents with cp(1) without going into
> the appropriate directory?

Don't know, I never used that option.

> The option only works when there is a concept of a current working
> directory.

Ah, thanks, I wasn't sure if it is just me not being able to figure it
out.

> In case it is really required, another option can be added, similar to
> the --directory option of tar(1).

Having a spec and a precedent (by referring to cp/tar), you might want
to move your proposal on to the dev list.

Bye,

	Benjamin.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Sunil Shetye <sh...@bombay.retortsoft.com>.
Quoting from Benjamin Pflugmann's mail on Mon, Nov 29, 2004 at 01:18:56PM +0100:
> On Sat 2004-11-27 at 13:08:15 +0530, Sunil Shetye wrote:
> > Quoting from Benjamin Pflugmann's mail on Fri, Nov 26, 2004 at 07:26:18PM +0100:
> > > > Is it possible to have an option like "--parents" to "svn copy" to
> > > > make tagging of some files easier?
> [...]
> > > a good start would to post a more specific explanation of
> > > how such a feature would work, as from the descriptions I read up to
> > > now, I am not clear what exactly --parents is meant to do.
> > 
> > The option is meant to be similar to the --parents option in cp(1).
> 
> What if you specify URLs as source?

Equivalently, how do you use --parents with cp(1) without going into
the appropriate directory?

The option only works when there is a concept of a current working
directory.

In case it is really required, another option can be added, similar to
the --directory option of tar(1).

-- 
Sunil Shetye.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Benjamin Pflugmann <be...@pflugmann.de>.
On Sat 2004-11-27 at 13:08:15 +0530, Sunil Shetye wrote:
> Quoting from Benjamin Pflugmann's mail on Fri, Nov 26, 2004 at 07:26:18PM +0100:
> > > Is it possible to have an option like "--parents" to "svn copy" to
> > > make tagging of some files easier?
[...]
> > a good start would to post a more specific explanation of
> > how such a feature would work, as from the descriptions I read up to
> > now, I am not clear what exactly --parents is meant to do.
> 
> The option is meant to be similar to the --parents option in cp(1).

What if you specify URLs as source?

> > If, on the other hands, a work-around is okay, but the one I presented
> > just doesn't do the job fully yet, tell me more about it, and I will
> > try to solve the remaining issues with you.
> 
> I guess, the workaround in which I have to manipulate the files not in
> package is not okay for me. I actually have more than 3000 files in my
> repository, more than 40 packages, and not more than 200 files per
> package. So, if your solution involves deleting almost all the files
> many times over, don't expect any new year wishes from me :-) In any
> case, just deleting the files doesn't seem to work (see below).

If the solution isn't interesting to you, I won't put in the effort to
get the details solved. I currently don't see a better (already
available) solution.

(Oh, regarding the rm: I think I just got it exactly the wrong way,
i.e. that you need to use "svn rm" not "rm". I already had that
working once, I just don't recall the details without actually doing
it again.)

[...]
> >   Nor with figuring out the stuff to remove (you obviously have a list
> >   of what to tag; it's easy to get a list of all items; so the list of
> >   items to remove is a simple operations on sets).
> 
> Not exactly. You also have to figure out which directories to remove.
> For example, if no file under src/ is in pkg1, then there is no point
> in tagging the empty directory src/.

I meant simple in the sense of easy to compute, not simple
implementation (in contrast to e.g. translating human languages, which
is hard to compute).

Bye,

	Benjamin.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Sunil Shetye <sh...@bombay.retortsoft.com>.
Quoting from Benjamin Pflugmann's mail on Fri, Nov 26, 2004 at 07:26:18PM +0100:
> > Is it possible to have an option like "--parents" to "svn copy" to
> > make tagging of some files easier?
> 
> Sure it would be possible. Whether the main developers would support
> such a feature is another question. Maybe you did this in an earlier
> email, but a good start would to post a more specific explanation of
> how such a feature would work, as from the descriptions I read up to
> now, I am not clear what exactly --parents is meant to do.

The option is meant to be similar to the --parents option in cp(1).

> If, on the other hands, a work-around is okay, but the one I presented
> just doesn't do the job fully yet, tell me more about it, and I will
> try to solve the remaining issues with you.

I guess, the workaround in which I have to manipulate the files not in
package is not okay for me. I actually have more than 3000 files in my
repository, more than 40 packages, and not more than 200 files per
package. So, if your solution involves deleting almost all the files
many times over, don't expect any new year wishes from me :-) In any
case, just deleting the files doesn't seem to work (see below).

> > > Of course, splitting up the packages in pkg1, pkg2 and pkg-common
> > > might be the better long-term solution.
> > 
> > Each individual package is meant to be compiled independently.
> 
> I don't see a contradiction with what I said?!

I thought that you meant that I should put shared files like
include/Makefile in pkg-common only and not in pkg1, etc. But, pkg1
requires include/Makefile to compile.

> * I don't see the problems with the number of steps (you don't need to
>   check out a new working copy, you already have one, don't you?).
> 
>   Nor with figuring out the stuff to remove (you obviously have a list
>   of what to tag; it's easy to get a list of all items; so the list of
>   items to remove is a simple operations on sets).

Not exactly. You also have to figure out which directories to remove.
For example, if no file under src/ is in pkg1, then there is no point
in tagging the empty directory src/.

>   And if you use "svn revert" at the end to restore the working copy
>   to the full state, the network traffic involved surely isn't
>   significantly more than in your preferred solution (if --parents
>   were supported).

Unfortunately, a simple "rm" on files doesn't affect the tagging
process.

$ ls
a.c a.h
$ rm a.h
$ svn copy . $REPOS/tags/test-tag -m 'created tag test-tag'
Committed revision 2.
$ svn ls $REPOS/tags/test-tag
a.c
a.h

I even tried "svn up" to get a complex working copy:

<http://svnbook.red-bean.com/en/1.0/ch04s06.html#svn-ch-4-sect-6.2>

$ ls
a.c a.h
$ svn up -r0 a.h
D  a.h
Updated to revision 0.
$ ls
a.c
$ svn copy . $REPOS/tags/test-tag2 -m 'created tag test-tag2'
Committed revision 3.
$ svn ls $REPOS/tags/test-tag2
a.c
a.h

So, "svn copy" seems to add files which are not in the working copy
magically!

>   And if you script that, this solution is not any more error-prone
>   than any other svn copy.

I meant that it could be error-prone if I also want to avoid tagging
empty directories.

-- 
Sunil Shetye.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Benjamin Pflugmann <be...@pflugmann.de>.
On Fri 2004-11-26 at 16:12:32 +0530, Sunil Shetye wrote:
> Quoting from Benjamin Pflugmann's mail on Thu, Nov 25, 2004 at 10:33:27PM +0100:
> > You can prepare a working copy to represent what you want to be tagged
> > and then tag the working copy.
[...]
> > should do what you expect (so long as I understood correctly what you
> > expect).
> 
> Yes, you have understood my problem correctly. If you do look at
> Method 3 in my original mail,
> 
> <http://subversion.tigris.org/servlets/ReadMsg?list=users&msgNo=21572>
> 
> it is similar to the method you have described. The only difference is
> that it does a "svn copy" first and then "svn rm" on the tag
> directory.

There is another difference: The method I suggested needs only one
commit and so only creates only one revision (ignore that, if you
don't (have to) care about the number of revisions / commit mails).

> And my original question was:
> 
> Is it possible to have an option like "--parents" to "svn copy" to
> make tagging of some files easier?

Sure it would be possible. Whether the main developers would support
such a feature is another question. Maybe you did this in an earlier
email, but a good start would to post a more specific explanation of
how such a feature would work, as from the descriptions I read up to
now, I am not clear what exactly --parents is meant to do.

> Why should I do tagging in a roundabout way when this one option is
> going to solve all my problems. With your solution, per package, I
> will have to:
> 
> 1) checkout the repository,
> 2) figure out what files and directories to remove,
> 3) remove them,
> 4) tag the remaining.
> 
> This obviously is a sub-optimal (and idiotic, IMO) way of tagging
> files. Not to mention, network-intensive. And error-prone, if I don't
> figure it out right!

IMHO, you overshoot the mark here. You presented problem and I
provided a workable solution. If you are not ready to accept a
work-around, but want to change subversion's behaviour, fine, just say
so (and please don't present bogus/assumed arguments*).

In that case I suggest you follow up the --parents idea on the dev
list. I will be out of this (because I am not interested in that
feature), but don't let that stop you.

If, on the other hands, a work-around is okay, but the one I presented
just doesn't do the job fully yet, tell me more about it, and I will
try to solve the remaining issues with you.

> > Of course, splitting up the packages in pkg1, pkg2 and pkg-common
> > might be the better long-term solution.
> 
> Each individual package is meant to be compiled independently.

I don't see a contradiction with what I said?!

Bye,

	Benjamin.



* I don't see the problems with the number of steps (you don't need to
  check out a new working copy, you already have one, don't you?).

  Nor with figuring out the stuff to remove (you obviously have a list
  of what to tag; it's easy to get a list of all items; so the list of
  items to remove is a simple operations on sets).

  And if you use "svn revert" at the end to restore the working copy
  to the full state, the network traffic involved surely isn't
  significantly more than in your preferred solution (if --parents
  were supported).

  And if you script that, this solution is not any more error-prone
  than any other svn copy.

  As I said above, if you don't see how the work-around accomplishes
  what I claim, I will be happy to work with you on that. Yes, it's
  not as nice as if it was a built-in feature. But that's why it's
  called work-around.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Sunil Shetye <sh...@bombay.retortsoft.com>.
Quoting from Benjamin Pflugmann's mail on Thu, Nov 25, 2004 at 10:33:27PM +0100:
> You can prepare a working copy to represent what you want to be tagged
> and then tag the working copy. That should handle both cases, a) and
> b) fine. Would that work for you?

...

> Done. You can either throught the working copy away or get back a full
> working copy by svn update. If you repeat the same procedure in order
> to tag REPOS/tags/pkg1-v101, then
> 
>   svn diff $REPOS/tags/pkg1-v100 $REPOS/tags/pkg1-v101
> 
> should do what you expect (so long as I understood correctly what you
> expect).

Yes, you have understood my problem correctly. If you do look at
Method 3 in my original mail,

<http://subversion.tigris.org/servlets/ReadMsg?list=users&msgNo=21572>

it is similar to the method you have described. The only difference is
that it does a "svn copy" first and then "svn rm" on the tag
directory. And my original question was:

Is it possible to have an option like "--parents" to "svn copy" to
make tagging of some files easier?

Why should I do tagging in a roundabout way when this one option is
going to solve all my problems. With your solution, per package, I
will have to:

1) checkout the repository,
2) figure out what files and directories to remove,
3) remove them,
4) tag the remaining.

This obviously is a sub-optimal (and idiotic, IMO) way of tagging
files. Not to mention, network-intensive. And error-prone, if I don't
figure it out right!

> Of course, splitting up the packages in pkg1, pkg2 and pkg-common
> might be the better long-term solution.

Each individual package is meant to be compiled independently.

-- 
Sunil Shetye.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Benjamin Pflugmann <be...@pflugmann.de>.
On Thu 2004-11-25 at 12:11:18 +0530, you wrote
[...]
> My repository contains source code of several packages. Some of the
> files are shared. An example:
> 
> pkg1:
> include/Makefile
> lib/Makefile
> lib/a.c
> 
> pkg2:
> include/Makefile
> include/b.h
> lib/Makefile
> lib/b.c
> 
> When I build a package, I like to tag the files of that specific
> package only. This way, when there is a problem between two versions
> of a package, the changes between the two versions can be reviewed.
> Something like:
> 
> svn diff $REPOS/tags/pkg1-v100 $REPOS/tags/pkg1-v101
> 
> Now, here if I tag the whole repository,
> 
> a) the above diff will contain changes to files not in that package.
> This makes reviewing the changes difficult.
>
> b) changes in the filelist of the package are not visible. For
> example, if I add/delete files to/from a package (but not necessarily
> to/from the repository!), the above diff will not indicate the change
> in package filelist.
>
> Please help me on this. Is there a better way to achieve this?

You can prepare a working copy to represent what you want to be tagged
and then tag the working copy. That should handle both cases, a) and
b) fine. Would that work for you?

In more detail: for the above example, you would checkout your
repository, which gives:

  include/Makefile
  include/b.h
  lib/Makefile
  lib/a.c
  lib/b.c

Then you remove (*not* "svn rm"!) the unwanted file: include/b.h and
lib/b.c. That leaves

  include/Makefile
  lib/Makefile
  lib/a.c

which is pkg1. Then you do the tagging like this (I never actually
tried this, so please verify that it fits your case):

  svn copy . REPOS/tags/pkg1-v100

Done. You can either throught the working copy away or get back a full
working copy by svn update. If you repeat the same procedure in order
to tag REPOS/tags/pkg1-v101, then

  svn diff $REPOS/tags/pkg1-v100 $REPOS/tags/pkg1-v101

should do what you expect (so long as I understood correctly what you
expect).

Of course, splitting up the packages in pkg1, pkg2 and pkg-common
might be the better long-term solution.

> [PARTLY OFFTOPIC:
> 
> I also tried keeping the filelist of a package in a separate file and
> then monitoring the changes. Something like:
> 
> svn diff -r20020:20024 $( cat file-containing-filelist-of-pkg1 )
> 
> Unfortunately, this command causes the repository to partly crash when

I think on these lists the term "wedged" is preferred for situations
where the data itself is safe, but the meta-data (db-locks, logfiles,
etc) have trouble.

> the package contains more than 60 files or so. I have already reported
> this problem for 1.1.0, but there was no relevant response on this.
> 
> <http://subversion.tigris.org/servlets/ReadMsg?list=users&msgNo=20325>
http://svn.haxx.se/users/archive-2004-10/1574.shtml
> <http://subversion.tigris.org/servlets/ReadMsg?list=users&msgNo=20362>

Hm. "Cannot allocate memory" is a bad error text from BDB. It rather
means "out of resources" as you get the error when BDB runs out of
locks, too. The second email seems to confirm this.

I don't actually know how it works, but it kinda sounds as if svn diff
tries to access all specified files in one sweep (transaction), only
releasing the resources properly when the program ends. The output in
the last email looks a lot like this. After fixing the first symptom
you are now running out of file descriptors, but the real problem is
that the resources are not freed in between diff's.

Here is another email that talks about DB_CONFIG values. I doubt this
helps in your case, but for reference it might be nice (especially
because it links to the man page for the config values):

  http://www.contactor.se/~dast/svn/archive-2002-05/0540.shtml

Bye,

	Benjamin.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by Sunil Shetye <sh...@bombay.retortsoft.com>.
Quoting from kfogel@collab.net's mail on Wed, Nov 24, 2004 at 12:37:52PM -0600:
> > I require to tag some files (spread over many directories) from the
> > repository for tracking changes in those files over time. subversion
> > does not seem to have a simple way of doing so. All methods of doing
> > so are either cumbersome or incorrect. Is it possible to add an option
> > like "--parents" to "svn copy" to ease tagging of specific files?
> 
> I guess it depends on what exactly you mean by "tracking changes in
> those files over time".  Describe your goal precisely, we may be able
> to help you out more.

My repository contains source code of several packages. Some of the
files are shared. An example:

pkg1:
include/Makefile
lib/Makefile
lib/a.c

pkg2:
include/Makefile
include/b.h
lib/Makefile
lib/b.c

When I build a package, I like to tag the files of that specific
package only. This way, when there is a problem between two versions
of a package, the changes between the two versions can be reviewed.
Something like:

svn diff $REPOS/tags/pkg1-v100 $REPOS/tags/pkg1-v101

Now, here if I tag the whole repository,

a) the above diff will contain changes to files not in that package.
This makes reviewing the changes difficult.

b) changes in the filelist of the package are not visible. For
example, if I add/delete files to/from a package (but not necessarily
to/from the repository!), the above diff will not indicate the change
in package filelist.

New pkg1:
include/Makefile
lib/Makefile
src/Makefile
src/c.c

Please help me on this. Is there a better way to achieve this?

[PARTLY OFFTOPIC:

I also tried keeping the filelist of a package in a separate file and
then monitoring the changes. Something like:

svn diff -r20020:20024 $( cat file-containing-filelist-of-pkg1 )

Unfortunately, this command causes the repository to partly crash when
the package contains more than 60 files or so. I have already reported
this problem for 1.1.0, but there was no relevant response on this.

<http://subversion.tigris.org/servlets/ReadMsg?list=users&msgNo=20325>
<http://subversion.tigris.org/servlets/ReadMsg?list=users&msgNo=20362>

Anyway, this technique does not work correctly when the filelist of
that package has changed between the two revisions.

]

-- 
Sunil Shetye.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: tagging just a few files

Posted by kf...@collab.net.
Sunil Shetye <sh...@bombay.retortsoft.com> writes:
> I require to tag some files (spread over many directories) from the
> repository for tracking changes in those files over time. subversion
> does not seem to have a simple way of doing so. All methods of doing
> so are either cumbersome or incorrect. Is it possible to add an option
> like "--parents" to "svn copy" to ease tagging of specific files?

Just tag the whole tree.  It doesn't cost any more than tagging the
individual files (in fact, it costs less).

I guess it depends on what exactly you mean by "tracking changes in
those files over time".  Describe your goal precisely, we may be able
to help you out more.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org