Today, you are prompted with the following error when submitting your project file to your local svn:
Expired: "global.php" in Transaction "21-1",
You are have to update your working copy a.
The following error occurred after you ran the update update and submitted again:
Svn:commit failed (Details follow): svn:aborting Commit: ' global.php ' remains in conflict checked SVN's manual to see if there was a conflict between multiple versions. At this point you need to resolve the conflict (merging other people's changes).
--------------------------------------------------------------------------------
For example, Sally modified Sandwich.txt,harry just changed the file in his local copy and submitted it to the server, and Sally updated its working copy before submitting it to the conflict:
$ svn update C sandwich.txt Updated to revision 2. $ ls-1 sandwich.txt sandwich.txt.mine sandwich.txt.r1 sandwich.txt.r2
In this case, subversion will not allow you to submit sandwich.txt until your three temporary files have been deleted.
$ svn commit--message "Add a few more things" Svn:commit failed (Details follow): svn:aborting commit: '/HOME/SALLY/SVN -work/sandwich.txt ' remains in conflict
If you encounter conflict, three things you can choose:
Manually merge conflicting text (check and modify conflicting flags in the file).
Overwrite your working file with a temporary file.
Run svn revert <filename> to discard all modifications.
Once you have resolved the conflict, you need to command SVN resolved to let subversion know, so that the three temporary files will be deleted, and subversion will not assume that the file is in a conflicting state.
$ SVN resolved Sandwich.txt resolved conflicted state of ' sandwich.txt '
Manual merge Conflict
The first attempt to resolve the conflict was scary, but after a little training it was as simple as riding a car downhill.
Here is a simple example, because of bad communication, you and colleagues Sally, while editing the sandwich.txt. Sally submitted the change, and when you are ready to update your version, the conflict has occurred and we have to modify the sandwich.txt to solve the problem. First, take a look at this file:
$ cat sandwich.txttop piece of breadmayonnaiselettucetomatoprovolone<<<<<<<. Minesalamimortadellaprosciutto=======sauerkrautgrilled chicken>>>>>>>. R2Creole Mustardbottom piece of bread less than, equals, and greater than strings are conflicting markers, not conflicting data, you must make sure that the content is deleted before the next commit, and the first two sets of flags are the changes you made in the conflict zone:
<<<<<<< minesalamimortadellaprosciutto======= between the two groups is Sally submitted the change conflict:
=======sauerkrautgrilled chicken>>>>>>>. R2 usually you don't want to just delete conflicting flags and Sally's modifications-when she gets a sandwich, it's very surprising. So you should go to her office or pick up the phone and tell Sally that you can't get the kimchi you want from the Italian deli. Once you have confirmed the submission, modify the file and delete the conflicting flags.
Top piece of breadmayonnaiselettucetomatoprovolonesalamimortadellaprosciuttocreole mustardbottom piece of Bread now runs SVN resolved, you are ready to submit:
$ svn resolved sandwich.txt$ svn commit-m "Go ahead" with my sandwich, discarding Sally ' s edits. " Remember, if you are confused when you modify a conflict, you can refer to the three files that subversion generates-including files that you haven't updated. You can also use a Third-party merge tool to test these three files.
Copy to cover your working file
If you just want to cancel your changes, you can simply copy subversion to replace your working copy of the file you generated:
$ svn Updatec sandwich.txtupdated to revision 2.$ ls sandwich.*sandwich.txt sandwich.txt.mine sandwich.txt.r2. txt.r1$ CP sandwich.txt.r2 sandwich.txt$ SVN resolved sandwich.txt bet: Use svn revert
If you get a conflict, after checking you decide to cancel your own changes and edit again, you can restore your changes:
$ svn revert sandwich.txtreverted ' sandwich.txt ' $ ls sandwich.*sandwich.txt Note that when you recover a conflicting file, you do not need to run SVN resolved again.
Now that we are ready to submit the changes, note that SVN resolved does not need arguments as much as any other command we've learned in this chapter, and that when you think you've resolved a conflict, you just have to run SVN resolved,-once you delete the temporary file, subversion will let you submit the file, Even if there are conflicting flags in the file.
Submit you have to revise
At last. Your modifications are over, you have merged all the changes on the server and you are ready to submit the modifications to the repository.
SVN commit sends all changes to the repository, and when you submit the changes, you need to provide some log information that describes the changes, your information will be attached to this revision, and if the information is brief, you can use the--message (-m) option on the command line:
$ svn commit--message "corrected number of cheese slices." Sending Sandwich.txt transmitting file data. Committed Revision 3.
However, if you write log information as part of your job, you may want to use the--file option by telling subversion a filename to get log information:
$ svn commit--file logmsg sending Sandwich.txt transmitting file data. Committed Revision 4.
If you do not specify a--message or--file option, Subversion automatically launches your favorite editor to edit the log information.
Version library don't know and don't care if your modifications make sense as a whole, it only checks if someone else has modified the same file, and if the other person has done so, your entire submission will fail and you are prompted that one or more files are obsolete:
$ svn commit--message "Add another rule" sending Rules.txt Svn:commit failed (details follow): Svn:out of Date: ' Rules. TXT ' in transaction ' G '
At this point, you need to run SVN update to handle all the merges and conflicts before you try to submit.
We've covered the basic work cycle of subversion, and there are many other features that can manage your repository and work copy, but you can easily work with just the commands described earlier.