I made special mention that my choice of Subversion was both tentative and unexpected. Moreover, I downloaded a minimum of files from the site to create the core version. Furthermore, upon writing a few new pages and fleshing out the directory structure I took another tentative step of informing the source control of the additions. By the last write up on using the system I was already quite comfortable with my choice and I made some other changes in the direcctory structure and downloaded what I hoped was the full set of files to represent its expected current state. I was moving quickly towards the commit stage.
It was at this point I began to wonder if my adding the new directories and a new file or two had automatically allowed the mass of the new downloaded files to be integrated magically within the source control system. I tended to doubt that scenario, since it would be to open to unintended effects. Thus, I thought at minimum I needed to rerun the add command for those directories that were introduced previously and do it for the first time where the content was entirely new.
Where it was new, it worked well:
:~/OST-1$ svn add floss/articles/ A floss/articles A floss/articles/OSS_white_paper.html A floss/articles/OSS-Welcome.html A floss/articles/OSS-Unix-WinServ-Alt.html A floss/articles/OSS-SA-Top-Misses.html ... ...
Whereas, for a repeat, it did not go as well:
:~/OST-1$ svn add ceo/articles/ svn: warning: 'ceo/articles' is already under version control
The result was both surprising to me and not, since I had already spent some time worrying about how the source control system would take to my extensive changes. I decided the best way to see was to rerun the status command:
:~/OST-1$ svn status ceo/articles/ ? ceo/articles/Small-to-Micro-GasTurbines-II.html ? ceo/articles/EU-climate-II.html ? ceo/articles/Small-to-Micro-GasTurbines-V.html ? ceo/articles/Electro-Pneumatic-Braking.html ... ... ? ceo/articles/ceo-start-page.html A ceo/articles A ceo/articles/EU-climate-I.html
I will not show it, however, I got nearly identical results checking the howto directory. At this point I began to read about the revert command. After a bit of hesitation, I ran it:
:~/OST-1$ svn revert howto/articles Reverted 'howto/articles'
Then I quickly reran the add command:
:~/OST-1$ svn add howto/articles/ A howto/articles A howto/articles/HowTo-VersionControl-I.html A howto/articles/HowTo-line-spacing-problem.html A howto/articles/HowTo-Internal-Bookmarks.html A howto/articles/HowTo-html-Coding-Templates.html A howto/articles/HowTo-html-coding-setup.html ... ...
Now all the articles I had brought over were recognized. At this point the entire structure of the project was fairly complex. To get a better picture of what residual actions I had taken I ran a status upon the entire project, but pulled only the modified files out:
:~/OST-1$ svn status | egrep '^M' M howto/HowTo-template.html M ceo/ceo-template-page.html M page-1/index.html M page-2/index-2.html
The above represented just a little less than the core I began as the definition of the base source in the Subversion version control system. I knew that I had added image directories, hence, I looked at more of the full status output:
:~/OST-1$ svn status ? howto/images/Band-Closeup.gif ? howto/images/Ff-2-0-revised-border-padding.jpg ? howto/images/Has-left-padding.jpg ? howto/images/no-left-padding.jpg ? howto/images/Safari-2-0-revised-border-padding-scaled.jpg ... ... ? howto/images/Safari-2-0-bottom-2nd-page.jpg A howto/images A howto/articles ... ...
Now it was clear I had to run through the same revert / add cycle for the images I had gone through previously for the articles. There is nothing new to be learned there, with one minor exception:
:~/OST-1$ svn ceo/images/ A ceo/images A (bin) ceo/images/Heat-energy-use-6.jpg A (bin) ceo/images/Heat-energy-use-5.jpg A (bin) ceo/images/Heat-energy-use-4.jpg A (bin) ceo/images/Heat-energy-use-2.jpg A (bin) ceo/images/calcars-poster1-thumb.gif A (bin) ceo/images/138496c9.jpg
Now you know images are a different file type. I followed up running the same process of adding the other image directories. At this point I had one other question: "had I inadvertantly missed an unknown component?". I ran a final check using the pipe and greping on the first character on the line being a "?" question mark. None were found. Nonetheless, I may have left files out by oversight that when found will have to be added to a latter version.
I had a suspicion here I would encounter problems. While I had no problem getting a full working copy from the source control system, I worried check in might not go as smoothly:
:~/OST-1$ svn commit -m "nearly current running site version" svn: Commit failed (details follow): svn: Can't create directory \ '/etc/subversion/repos/db/transactions/1-1.txn':\ Permission denied
The obvious key here is my lack of write rights upon a directory that belongs to root, or at least one with sudo rights. Nonetheless, I persisted and tried the same command with the password I attached at the time of setup. This too failed, hence, I changed my identity from a user with limited rights to another user that could use either sudo or become su. With supervisor rights it worked:
# svn commit -m "nearly current running site version" Adding ceo/articles Adding ceo/articles/EU-climate-I.html Adding ceo/articles/EU-climate-II.html Adding ceo/articles/Electro-Pneumatic-Braking.html ... ... Adding (bin) index/images/firefox-spread-btn-4-small.png Adding (bin) index/images/handcode-frk.jpg Sending page-1/index.html Sending page-2/index-2.html Transmitting file data ................. [truncated] Committed revision 2.
So the version was committed successfully, now we start the cycle over again as the user with the much more limited rights:
:~/OST-1$ svn checkout file:///etc/subversion/repos/OST-1 A OST-1/howto A OST-1/howto/images A OST-1/howto/images/Band-Closeup.gif ... ... A OST-1/css A OST-1/css/style-sheet.css A OST-1/page-1 A OST-1/page-1/index.html A OST-1/page-2 A OST-1/page-2/index-2.html A OST-1/page-3 Checked out revision 2.
We are ready for another cycle.
How To: Coding html and css files by hand. We will end here for the moment. Despite my original reason adding the version (souurce) system was to seek an easier way to change my pages to a more consistent form, the conflict resolution does not work for a single user. Moreover, I now doubt it would be helpful in my case. Nonetheless, let me encourage you to begin reading the Subversion documentation where you concentrate on the section "Resolve Conflicts" it might be helpful.
Corrections, suggested extension or comments write: How-To-Guy. If the mailto does not work, use this: hcohen[-At-]bst-softwaredevs.com.
© Herschel Cohen, All Rights Reserved
* Originally published on the Open Source Today site September 12, 2007. Content may have been altered prior to being moved onto Web Site Developers.