No announcement yet.

Can SVN ensure that file that is checked in is the file that is checked out ?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Can SVN ensure that file that is checked in is the file that is checked out ?


    Need some advice whether SVN is able to prevent the below scenario from happening ?


    - Developer A checks out a file. For ease, we call this file 'File A'.
    - Developer B, who also wants to work on the file, gets a read only version of 'File A' and starts to make amendments it.
    - Developer A completes the amendment to 'File A' and checks in 'File A' (i.e. File A`)
    - Developer B now checks out 'File A`', replaces the amended readonly 'File A' he got previously.
    - Developer B checks in the amended readonly 'File A'. The changes that was made in 'File A`' are lost.

    Appreciate your assistance regarding this.

    Thank you for your time and attention

  • #2
    There's two solutions for this. One would be for each developer to lock a file when it's checked out for working on, which should prevent any other changes being made to it.

    The other is that once developer A has committed his changes, when developer B tries to commit the same file subversion will know developer B is a revision behind on that file and enforce a merge of the two files rather than overwriting.


    • #3
      Hi Orbey,

      Thank you very much for the quick response.
      I am for option 2 to enforce a merge of the 2 files instead of overwriting.
      May I know how can I enforce the merge ? Is it a configuration that can be set in subversion ?
      Appreciate you can redirect me to how I can do so.

      Sorry for the 'dummy' questions as I am new to subversion.

      Thank you


      • #4
        You shouldn't need to do anything, Subversion should do it automatically? If you're worried about it try having two people check out a separate working copy from the repository, edit the same file but in different ways and then have them both commit back one after the other. The second user should be prompted to merge the changes.

        Please let us know if it doesn't go as planned.


        • #5
          I can't find any documentation on the svnnotifier website, but it does have an email link to contact the project's owner - it'd probably be worth getting in touch with them to see if there's any documentation available?