You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Alexis Huxley <ah...@gmx.net> on 2002/05/01 18:43:07 UTC

how to tell what I need to 'svn add' ?

Hi, having successfully compiled SVN a couple of weeks ago, and now
modified all the source trees that I wish to commit to not use symlinks
;-) I now come to actually doing my first 'import'. It worked fine.

I'm not a CVS user (only RCS/SCCS with home-rolled 'releaser' scripts),
so sorry if the following questions are not SVN one, but more on the
philosophy of working with SCM tools.

In the SVN user manual it says that sources are registered with the
working copy by using 'svn add'. Fine, but do people (i) immediately
'svn add' stuff as they create it - even though 30 seconds later
they might realise the file they created was a bad idea, or (ii) 'svn
add' stuff once the stuff has been around long enough for the person to
be sure creating the file was more than just a passing fancy or (iii)
just before 'svn commit' or (iv) at some other 'mental event'? :-)

For myself, I tend to brainstorm a bit and then clean up afterwards,
making me a '(iii)' sort of person, but then I need the equivalent
of 'diff -r <pristene-tree> <current-tree>', but I can't find any
mention of this in the svn man page, or the user-manual or notes
directories. 'svn diff' appears to show the difference between the
pristene tree and the current tree *excluding* what has not yet been
'svn add'ed (I tried touching a new file and then 'svn diff' and no
differences were shown).

Does such a oh-yes-thanks-for-reminding-me-that-i-created-that-file-
but-haven't-svn-added-it-yet tool exist, or do I have to change
the way I work? Can anyone offer technical or philosophical advice,
or point me in the direction of something explaining these things?

Thanks!

Alexis

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

Re: how to tell what I need to 'svn add' ?

Posted by Alexis Huxley <ah...@gmx.net>.
> > rm some-other-existing-file.c
> > svn del some-other-existing-file.c
> 
> you can skip the rm.  assuming you haven't made any changes to the
> file, svn rm will get rid of it for you.

Yes, but I can imagine a scenario where you *thought*
some-other-existing-file.c was not needed any more but actually it was,
which not removing it immediately will not reveal to you. i.e. 'make'
doesn't know you've typed 'svn del' ;-)

> > make 
> > make clean                       <-- so I don't check in objects, etc 
> 
> no need for this step.  'svn commit' will only commit things you have
> explicitly added.  the object files won't get checked in unless you
> specifically tell it to.

Yes, in this case that's now clear to me.

Ok, I'll go and play for a bit more now, thanks all.

Alexis

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

Re: how to tell what I need to 'svn add' ?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Wed, May 01, 2002 at 09:13:06PM +0200, Alexis Huxley wrote:
 
> So, the correct cycle for a mod/add/del from scratch is:
> 
> svn co <uri-for-whatever>
> cd <whatever>
> vi some-new-file.c
> vi some-other-new-file.c
> svn st
> svn add some-new-file.c          <-- add what is unknown to working copy
> svn add some-other-new-file.c
> vi some-existing-file.c
> rm some-other-existing-file.c
> svn del some-other-existing-file.c

you can skip the rm.  assuming you haven't made any changes to the
file, svn rm will get rid of it for you.

> make 
> make clean                       <-- so I don't check in objects, etc 

no need for this step.  'svn commit' will only commit things you have
explicitly added.  the object files won't get checked in unless you
specifically tell it to.

> cd -
> svn commit
> 
> Is that right? Thanks for all the help ...

other than those two things, yep.

-garrett 

-- 
garrett rooney                    Remember, any design flaw you're 
rooneg@electricjellyfish.net      sufficiently snide about becomes  
http://electricjellyfish.net/     a feature.       -- Dan Sugalski

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

Re: how to tell what I need to 'svn add' ?

Posted by Ben Collins-Sussman <su...@collab.net>.
Alexis Huxley <ah...@gmx.net> writes:

> svn co <uri-for-whatever>
> cd <whatever>
> vi some-new-file.c
> vi some-other-new-file.c
> svn st
> svn add some-new-file.c          <-- add what is unknown to working copy
> svn add some-other-new-file.c
> vi some-existing-file.c
> rm some-other-existing-file.c
> svn del some-other-existing-file.c
> make 
> make clean                       <-- so I don't check in objects, etc 
> cd -
> svn commit

Sure, that works.   A couple of points:

 * you don't need to worry about committing object files.  did you
   explicitly schedule them for addition using 'svn add'?  If not,
   they won't be committed.  They're just ignored, unversioned files.

 * most people tend to run 'svn update' before committing, to make
   sure they don't receive any conflicting changes from other people.
   They also tend to run 'svn status' to make sure they're committing
   the list of changes they want.  :-)


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

Re: how to tell what I need to 'svn add' ?

Posted by Alexis Huxley <ah...@gmx.net>.
Nathan wrote:

> When you invoke 'svn st' it will show all the files that the client does
> not know about, preceeded with a question mark, except those being
> ignored, of course.

Ah ... super thanks!

Ben wrote:

> That's true.  'svn diff' shows local modifications to your working
> copy.  A scheduled addition is a type of local modification.  That's
> why it's probably easier to just 'svn add' files right when you create
> them -- you'll see them in the diffs.  You can always un-schedule the
> addition later if you want.

So, the correct cycle for a mod/add/del from scratch is:

svn co <uri-for-whatever>
cd <whatever>
vi some-new-file.c
vi some-other-new-file.c
svn st
svn add some-new-file.c          <-- add what is unknown to working copy
svn add some-other-new-file.c
vi some-existing-file.c
rm some-other-existing-file.c
svn del some-other-existing-file.c
make 
make clean                       <-- so I don't check in objects, etc 
cd -
svn commit

Is that right? Thanks for all the help ...

Studiously,

Alexis

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

Re: how to tell what I need to 'svn add' ?

Posted by Nathan Fiedler <nf...@bluemarsh.com>.
When you invoke 'svn st' it will show all the files that the client does
not know about, preceeded with a question mark, except those being
ignored, of course.

nathan


On Wed, 2002-05-01 at 11:43, Alexis Huxley wrote:
> Does such a oh-yes-thanks-for-reminding-me-that-i-created-that-file-
> but-haven't-svn-added-it-yet tool exist, or do I have to change
> the way I work? Can anyone offer technical or philosophical advice,
> or point me in the direction of something explaining these things?



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

Re: how to tell what I need to 'svn add' ?

Posted by Philip Martin <ph...@codematters.co.uk>.
Ben Collins-Sussman <su...@collab.net> writes:

> Therefore, it doesn't matter when you schedule the addition.  You can
> do it at any of the times you suggest.   If you change your mind, you
> can *un*-schedule the addition by doing either 'svn revert foo.c' or
> 'svn rm foo.c'. 

If foo.c is scheduled for addition (i.e. after 'svn add foo.c') then
'svn revert foo.c' will undo the 'svn add' and leave foo.c as an
unversioned file.

If you try to use 'svn rm foo.c' to undo the add it will fail. You
need to use 'svn rm --force foo.c' which will undo the add and also
delete foo.c from the filesystem.

-- 
Philip

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

Re: how to tell what I need to 'svn add' ?

Posted by Ben Collins-Sussman <su...@collab.net>.
Alexis Huxley <ah...@gmx.net> writes:

> In the SVN user manual it says that sources are registered with the
> working copy by using 'svn add'. Fine, but do people (i) immediately
> 'svn add' stuff as they create it - even though 30 seconds later
> they might realise the file they created was a bad idea, or (ii) 'svn
> add' stuff once the stuff has been around long enough for the person to
> be sure creating the file was more than just a passing fancy or (iii)
> just before 'svn commit' or (iv) at some other 'mental event'? :-)

'svn add' simply schedules a file for addition to the repository;
it's not actually sent until you 'svn commit'.

Therefore, it doesn't matter when you schedule the addition.  You can
do it at any of the times you suggest.   If you change your mind, you
can *un*-schedule the addition by doing either 'svn revert foo.c' or
'svn rm foo.c'. 

As Nathan said, 'svn status' will show you local modifications, and
print '?' next to unversioned things in your working copy -- thus
serving as a reminder that things might need to be added.

> 'svn diff' appears to show the difference between the pristene tree
> and the current tree *excluding* what has not yet been 'svn add'ed
> (I tried touching a new file and then 'svn diff' and no differences
> were shown).

That's true.  'svn diff' shows local modifications to your working
copy.  A scheduled addition is a type of local modification.  That's
why it's probably easier to just 'svn add' files right when you create
them -- you'll see them in the diffs.  You can always un-schedule the
addition later if you want.



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