Help with files changed outside of svn

2011-02-28 Thread Christopher D Haakinson

I'm fairly new to svn, and I have things set up and running well.

I wanted to test out a scenario where a file controlled by svn gets changed
outside of svn inside the working copy, and now I'm lost and can't find
much help on what to do.

Here's my example:  I setup the hooks folder as a svn project. Checked it
out onto my windows box and made a small change, then committed the
changes.
Now I went through my command shell and manually changed a file outside of
svn.
Then I went back to my windows box and editted the same file with a
different change.
Now the original file contains:   .r3 at the bottom

Also I have some more files inside my working directory too:

 pre-revprop-change.tmpl
 pre-revprop-change.tmpl.mine
 pre-revprop-change.tmpl.r2
 pre-revprop-change.tmpl.r3


Can someone please explain to me:

1) Why does  get put into the bottom of my files?
2) What are the 3 copies of this file for?

3) And now how do I get these files merged back into one copy with the
changes made inside svn included and the changes made outside svn excluded?

Re: Help with files changed outside of svn

2011-02-28 Thread Andy Levy
On Mon, Feb 28, 2011 at 10:54, Christopher D Haakinson
cdhaa...@us.ibm.com wrote:
 I'm fairly new to svn, and I have things set up and running well.

 I wanted to test out a scenario where a file controlled by svn gets changed
 outside of svn inside the working copy, and now I'm lost and can't find much
 help on what to do.

 Here's my example: I setup the hooks folder as a svn project. Checked it out
 onto my windows box and made a small change, then committed the changes.
 Now I went through my command shell and manually changed a file outside of
 svn.
 Then I went back to my windows box and editted the same file with a
 different change.

Do you mean to say that you edited the same file in multiple working
copes? There is no outside svn as svn isn't a program in which you
edit files, and you can't edit directly in the repository.

 Now the original file contains:  .r3 at the bottom

 Also I have some more files inside my working directory too:

 pre-revprop-change.tmpl
 pre-revprop-change.tmpl.mine
 pre-revprop-change.tmpl.r2
 pre-revprop-change.tmpl.r3


 Can someone please explain to me:

 1) Why does  get put into the bottom of my files?
 2) What are the 3 copies of this file for?

You have generated a merge conflict - you've changed the same line(s)
of the file in 2 different ways.

 3) And now how do I get these files merged back into one copy with the
 changes made inside svn included and the changes made outside svn excluded?

You must now resolve the conflicts. See
http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.resolve

As I said above, there is no outside vs. inside svn - you apparently
have changes made from 2 different working copies. This is a normal
situation but Subversion cannot handle this for you automatically -
YOU must tell Subversion which content is correct.


Re: Help with files changed outside of svn

2011-02-28 Thread Christopher D Haakinson

I mean that I have a working copy of my project under:
/svn/hooks

This folder gets automatically updated with svn update on every commit with
a post-commit hook
This folder also is live, meaning that the files here are in use at all
times, so nobody will be using this working copy as their development
copy, it's just there to receive all the newest changes.

The scenario I want to test and know how to handle is when a file
in /svn/hooks gets changed outside of svn and these changes never get
commited into svn.

I understand what svn is and is not, but the files I will have inside svn
will also be available and writable on a network, so I need to know how to
handle files that get changed inside my live working folder outside of svn.



Also is there a way to change what gets written to a file when this occurs?
All my scripts get corrupted because of the  and I'd like to at
least put a # in front so that it's a commented line and doesn't affect the
execution...


|
| From:  |
|
  
-|
  |Andy Levy andy.l...@gmail.com  
|
  
-|
|
| To:|
|
  
-|
  |Christopher D Haakinson/Raleigh/IBM@IBMUS
|
  
-|
|
| Cc:|
|
  
-|
  |users@subversion.apache.org  
|
  
-|
|
| Date:  |
|
  
-|
  |02/28/2011 11:02 AM  
|
  
-|
|
| Subject:   |
|
  
-|
  |Re: Help with files changed outside of svn   
|
  
-|





On Mon, Feb 28, 2011 at 10:54, Christopher D Haakinson
cdhaa...@us.ibm.com wrote:
 I'm fairly new to svn, and I have things set up and running well.

 I wanted to test out a scenario where a file controlled by svn gets
changed
 outside of svn inside the working copy, and now I'm lost and can't find
much
 help on what to do.

 Here's my example: I setup the hooks folder as a svn project. Checked it
out
 onto my windows box and made a small change, then committed the changes.
 Now I went through my command shell and manually changed a file outside
of
 svn.
 Then I went back to my windows box and editted the same file with a
 different change.

Do you mean to say that you edited the same file in multiple working
copes? There is no outside svn as svn isn't a program in which you
edit files, and you can't edit directly in the repository.

 Now the original file contains:  .r3 at the bottom

 Also I have some more files inside my working directory too:

 pre-revprop-change.tmpl
 pre-revprop-change.tmpl.mine
 pre-revprop-change.tmpl.r2
 pre-revprop-change.tmpl.r3


 Can someone please explain to me:

 1) Why does  get put into the bottom of my files?
 2) What are the 3 copies of this file for?

You have generated a merge conflict - you've changed the same line(s)
of the file in 2 different ways.

 3) And now how do I get these files merged back into one copy with the
 changes made inside svn included and the changes made outside svn
excluded?

You must now resolve the conflicts. See
http://svnbook.red-bean.com/nightly/en

Re: Help with files changed outside of svn

2011-02-28 Thread David Chapman

On 2/28/2011 8:13 AM, Christopher D Haakinson wrote:


I mean that I have a working copy of my project under:
/svn/hooks

This folder gets automatically updated with svn update on every commit 
with a post-commit hook
This folder also is live, meaning that the files here are in use at 
all times, so nobody will be using this working copy as their 
development copy, it's just there to receive all the newest changes.


The scenario I want to test and know how to handle is when a file in 
/svn/hooks gets changed outside of svn and these changes never get 
commited into svn.


I understand what svn is and is not, but the files I will have inside 
svn will also be available and writable on a network, so I need to 
know how to handle files that get changed inside my live working 
folder outside of svn.




This is asking for trouble.  You want your Subversion repository to be 
up and running at all times.  Version control systems cannot prevent all 
merge conflicts, so your repository could very well go down whenever a 
conflict occurs.  The repository control directories (such as the hooks 
directory) should be tightly controlled, not open to any and all 
modifications, and certainly not changing on the fly.


As Andy Levy said, Subversion does not care how the files are modified.  
It is a lightweight system, meaning that it doesn't run unless you tell 
it to.  And so it doesn't know that files in a working copy are modified 
until you tell it.





Also is there a way to change what gets written to a file when this 
occurs? All my scripts get corrupted because of the  and I'd 
like to at least put a # in front so that it's a commented line and 
doesn't affect the execution...




This particular conflict might not have affected execution, but you 
can't guarantee this will always occur.  What if you have a conflict of 
the form: exit 0 vs. exit 1?  How is Subversion supposed to know 
which is correct?  This is why conflict resolution is manual.  Trust me 
- you really, really, want to have conflicts be obvious and cause 
problems; you don't want them hidden.


If you really want to have your repository's hooks directory updated 
through Subversion (which I do not recommend), make the directory 
writable only by the process that is running Subversion so that only the 
post-commit hook script can change it.  Don't *ever* allow users to 
modify files in that directory.


--
David Chapman dcchap...@acm.org
Chapman Consulting -- San Jose, CA



Re: Help with files changed outside of svn

2011-02-28 Thread Ryan Schmidt

On Feb 28, 2011, at 10:13, Christopher D Haakinson wrote:

 I mean that I have a working copy of my project under:
 /svn/hooks
 
 This folder gets automatically updated with svn update on every commit with a 
 post-commit hook
 This folder also is live, meaning that the files here are in use at all 
 times, so nobody will be using this working copy as their development copy, 
 it's just there to receive all the newest changes.
 
 The scenario I want to test and know how to handle is when a file in 
 /svn/hooks gets changed outside of svn and these changes never get commited 
 into svn.
 
 I understand what svn is and is not, but the files I will have inside svn 
 will also be available and writable on a network, so I need to know how to 
 handle files that get changed inside my live working folder outside of svn.

If that's how you have Subversion set up (a directory containing the hooks, and 
it is a working copy of a repository, and it is automatically updated in a 
post-commit hook), then the post-commit hook really must be the only thing 
modifying it. Nobody should have the ability to make changes there manually. 
All changes to this directory should occur by making the change in a working 
copy the user has checked out, then committing the change.


 Also is there a way to change what gets written to a file when this occurs? 
 All my scripts get corrupted because of the  and I'd like to at least 
 put a # in front so that it's a commented line and doesn't affect the 
 execution...

It is up to the user to resolve the merge conflict (i.e. remove those lines and 
retain the correct merged version of the code) before committing the changes, 
before the server can svn update its private working copy and try to run the 
scripts there.





Re: Help with files changed outside of svn

2011-02-28 Thread Andy Levy
On Mon, Feb 28, 2011 at 11:13, Christopher D Haakinson
cdhaa...@us.ibm.com wrote:

 I mean that I have a working copy of my project under:
 /svn/hooks

 This folder gets automatically updated with svn update on every commit with a 
 post-commit hook
 This folder also is live, meaning that the files here are in use at all 
 times, so nobody will be using this working copy as their development copy, 
 it's just there to receive all the newest changes.

If you're getting conflicts in those files when performing an update,
then someone *is* using that working copy. Otherwise, the changes
would be merged without conflict into that working copy.

 The scenario I want to test and know how to handle is when a file in 
 /svn/hooks gets changed outside of svn and these changes never get commited 
 into svn.

 I understand what svn is and is not, but the files I will have inside svn 
 will also be available and writable on a network, so I need to know how to 
 handle files that get changed inside my live working folder outside of svn.

Again, outside/inside svn has no meaning (or ambiguous meaning) in
this context - please try to find the correct terminology to use here
to remove this ambiguity. It sounds like your workflow is supposed to
be:

1) Hook developer checks out hook scripts from repository to a local WC
2) Make edits
3) Commit changes to hook script
4) Hook scripts are auto-updated in /svn/hooks via a hook.

Result: Nothing should be in /svn/hooks that isn't in the repository.

What appears to be happening is that someone is editing in /svn/hooks
while at the same time someone else (or maybe the same person) is
editing in their own WC. This can generate a conflict when those
changes are committed from one WC and updated into the other.

Solution: lock people out of making changes to /svn/hooks, except via
that hook script that pulls the updates down. You should not get any
conflicts this way.

Alternate solution: Require people to only make changes in /svn/hooks,
and disallow commits from any other location (which would not be easy,
as the hook script does not know where on the client content is being
committed from - you'd have to do some per-user permissions  only
allowed a specific person/group to commit, and trust them to do the
right thing).

 Also is there a way to change what gets written to a file when this occurs? 
 All my scripts get corrupted because of the  and I'd like to at least 
 put a # in front so that it's a commented line and doesn't affect the 
 execution...

No, part of the point of doing this is to make it *very* obvious that
something needs to be fixed. Even if those lines were commented out,
the content between them would likely break your script, or at least
cause unpredictable/undesired behavior.

 Andy Levy ---02/28/2011 11:02:11 AM---On Mon, Feb 28, 2011 at 10:54, 
 Christopher D Haakinson


 From:
 Andy Levy andy.l...@gmail.com
 To:
 Christopher D Haakinson/Raleigh/IBM@IBMUS
 Cc:
 users@subversion.apache.org
 Date:
 02/28/2011 11:02 AM
 Subject:
 Re: Help with files changed outside of svn
 


 On Mon, Feb 28, 2011 at 10:54, Christopher D Haakinson
 cdhaa...@us.ibm.com wrote:
  I'm fairly new to svn, and I have things set up and running well.
 
  I wanted to test out a scenario where a file controlled by svn gets changed
  outside of svn inside the working copy, and now I'm lost and can't find much
  help on what to do.
 
  Here's my example: I setup the hooks folder as a svn project. Checked it out
  onto my windows box and made a small change, then committed the changes.
  Now I went through my command shell and manually changed a file outside of
  svn.
  Then I went back to my windows box and editted the same file with a
  different change.

 Do you mean to say that you edited the same file in multiple working
 copes? There is no outside svn as svn isn't a program in which you
 edit files, and you can't edit directly in the repository.

  Now the original file contains:  .r3 at the bottom
 
  Also I have some more files inside my working directory too:
 
  pre-revprop-change.tmpl
  pre-revprop-change.tmpl.mine
  pre-revprop-change.tmpl.r2
  pre-revprop-change.tmpl.r3
 
 
  Can someone please explain to me:
 
  1) Why does  get put into the bottom of my files?
  2) What are the 3 copies of this file for?

 You have generated a merge conflict - you've changed the same line(s)
 of the file in 2 different ways.

  3) And now how do I get these files merged back into one copy with the
  changes made inside svn included and the changes made outside svn excluded?

 You must now resolve the conflicts. See
 http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.resolve

 As I said above, there is no outside vs. inside svn - you apparently
 have changes made from 2 different working copies. This is a normal
 situation but Subversion cannot handle this for you automatically -
 YOU must tell Subversion which content is correct.