<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Santiance &#187; bzr</title>
	<atom:link href="http://santiance.com/tag/bzr/feed/" rel="self" type="application/rss+xml" />
	<link>http://santiance.com</link>
	<description>Kristopher Ives&#039;s Developer Notes</description>
	<lastBuildDate>Tue, 31 Aug 2010 23:00:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>A Bazaar List of Things</title>
		<link>http://santiance.com/2010/04/a-bazaar-list-of-things/</link>
		<comments>http://santiance.com/2010/04/a-bazaar-list-of-things/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 07:35:40 +0000</pubDate>
		<dc:creator>Kristopher Ives</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bazaar]]></category>
		<category><![CDATA[bzr]]></category>

		<guid isPermaLink="false">http://santiance.com/?p=981</guid>
		<description><![CDATA[So I&#8217;ve been doing a lot of work with Bazaar version control. I&#8217;ve used it in the past on some projects, and integrated it to keep multiple environments synchronized, but recently I had to do a lot more with it. Here are some questions and answers: What happens if I push a file that already [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been doing a lot of work with <em>Bazaar</em> version control. I&#8217;ve used it in the past on some projects, and integrated it to keep multiple environments synchronized, but recently I had to do a lot more with it. Here are some questions and answers:</p>
<p><br class="spacer_" /></p>
<h3>What happens if I push a file that already exists unversioned downstream?</h3>
<p>It will move the old file out of the way. This can be somewhat confusing if directories are involved, so here is a good example: Suppose you have a branch sparsely versioned (mixed in with stuff that isn&#8217;t versioned) and you make an identical copy. This copy contains both the version and unversioned contents. At this point both read out like this:</p>
<ul>
<li>Branch
<ul>
<li>index.html (versioned)</li>
<li>styles (<strong>unversioned</strong>)
<ul>
<li>common.css (unversioned)</li>
<li>specific.css (unversioned)</li>
</ul>
</li>
<li>zscript.php (versioned)</li>
</ul>
</li>
</ul>
<p>Now down the line, you decide to version <code>styles/common.css</code>, but when you push find this:</p>
<pre style="padding-left: 30px;">Conflict adding file styles.  Moved existing file to styles.moved.
1 conflicts encountered.</pre>
<p>Now you&#8217;ll find that the <code>styles/</code> directory only contains the <code>common.css</code>, with <code>specific.css</code> being placed into the <code>styles.moved</code> directory:</p>
<ul>
<li>Branch
<ul>
<li>index.html (versioned)</li>
<li>styles (versioned)
<ul>
<li>common.css (versioned)</li>
</ul>
</li>
<li>styles.moved (unversioned)
<ul>
<li>common.css (unversioned)</li>
<li><strong>specific.css</strong> (unversioned)</li>
</ul>
</li>
<li>zscript.php (versioned)</li>
</ul>
</li>
</ul>
<p>The main effect of this is that <code>specific.css</code> is moved out of the way. This will happen (writing as of  <code>bzr 2.1.1</code>) even if the versioned contents is identical. This is rather counter-intuitive to how mixing versioned and unversioned contents is otherwise tolerable.</p>
<p><br class="spacer_" /></p>
<h3 style="font-size: 1.17em;">What happens to a remove a file then push somewhere it exists unversioned?</h3>
<p>Suppose you have a repository with some files under version control, and you&#8217;re pushing or pulling to another branch. Most likely scenario is a development, testing, or production branch/server. As you probably know, there is the <code>--keep</code> option, which leaves the file in the working tree (usually the file system). However, if the branch is pushed/pulled the files will be removed! Right now the only way (as of 2.1) to have the file not get removed on a push/pull is to also do a <code>bzr rm</code> before the push on the same file, but that&#8217;s not a realistic solution. See this <a href="http://stackoverflow.com/questions/2648362/remove-files-from-bazaar/2650778#2650778">Stack Overflow discussion</a>.</p>
<p><br class="spacer_" /></p>
<div id="_mcePaste"><strong>What&#8217;s with <code>bzr update</code>?</strong></div>
<p>If you use FTP (or other &#8220;dumb&#8221; protocols), you&#8217;ll probably at some time be told to run <code>bzr update</code> to update the current working copy. To avoid this, I usually do a <code>bzr pull</code> instead when using FTP to avoid this.</p>
<h3>What&#8217;s wrong with my <code>bzr diff</code>?</h3>
<p>If you&#8217;re getting stupid results from <code>bzr diff</code>, it&#8217;s probably because the line endings. If someone transfered the files from a Windows to a Linux machine or used the wrong FTP settings. Try running <code>dos2unix -U</code> (this is in the <code>tofrodos</code> package on Debian/Ubuntu Linux) on files of interest. Something like this usually works:</p>
<pre>dos2unix -U `find | grep "\.php$"`</pre>
<p>That will fix the lines on all your PHP files, as <code>find</code> is recursive. You can also use <code>fromdos</code> or a custom scrip that removes <code>\r</code> from <code>\r\n</code> combinations, but I would use the existing packages if possible.</p>
<h3>How can I get a list of all the files under version control?</h3>
<p>You can use <code>bzr ls -VR --kind=file</code> to list out just the files. It can be useful to create this list in one branch, then use the file list relative to another branch. For example, assuming <code>files.txt</code> is the output from the former <code>bzr ls</code> command:﻿</p>
<pre>tar -czf core_backup.tgz `cat files.txt`</pre>
<h3></h3>
<h3>How can I synchronize similar code bases?</h3>
<p>You&#8217;ve probably got some existing downstream code bases you want to keep under version control. The problem here is that you have to create one branch before another, and either way they&#8217;ll start out not the same and have to be merged, right? One solution is to version the base system files that you&#8217;ll be providing updates for. This doesn&#8217;t include stylesheets, site-specific templates, etc. After having done a <code>bzr commit</code>, go to the branch directory and copy the <code>.bzr/</code> directory to the downstream branch directory (which has the similar content). To archive the <code>.bzr/</code>:</p>
<pre>tar -czf devbz.tgz .bzr/</pre>
<p>Once you copy <code>dev.tgz</code> to the downstream branch you can untar it by:</p>
<pre>tar -xzf devbzr.tgz</pre>
<p>Now you&#8217;ll have the <code>.bzr</code> and you can do something like <code>bzr revno</code> or <code>bzr log</code> to see that the version information has been ported. To see what&#8217;s different, use <code>bzr diff <em>somefile</em></code> and do other standard Bazaar operations to check out how the changes differ. However, if you do a <code>bzr commit</code>, that makes the downstream branch ahead of your development, which probably isn&#8217;t what you want. What I do here is a <code>bzr export</code> from the dev branch to the downstream:</p>
<pre>bzr export dev.tgz</pre>
<p>Which will have all of the files in the dev branch in a sub directory with the name of the branch. I use this command to untar it into the downstream directory, overwriting everything:</p>
<pre>tar -xzf dev.tgz --strip-components 1</pre>
<p>The two branches will be the same now, so a <code>bzr commit</code> won&#8217;t need to be made. Now you can make changes to the dev branch, and do a <code>bzr pull</code> or <code>bzr push</code> to get the changes into the downstream.</p>
<h3>Can I push/pull from a branch with uncommitted changes?</h3>
<p>Yeah, use the <code>--no-strict</code> option. This is nice if you forgot to do a push, then made some changes, but don&#8217;t want to <code>bzr revert</code> and lose them or <code>bzr shelve</code> them.</p>
]]></content:encoded>
			<wfw:commentRss>http://santiance.com/2010/04/a-bazaar-list-of-things/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello Joomla! A Minimal Joomla Component</title>
		<link>http://santiance.com/2010/04/hello-joomla-a-minimal-joomla-component/</link>
		<comments>http://santiance.com/2010/04/hello-joomla-a-minimal-joomla-component/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 03:55:39 +0000</pubDate>
		<dc:creator>Kristopher Ives</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bzr]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://santiance.com/?p=956</guid>
		<description><![CDATA[Joomla is a nice framework, but indeed it&#8217;s quite large and can seem cumbersome. I can&#8217;t look away from some of the redundancies and odd naming conventions, however, I don&#8217;t think it&#8217;s complicated. There are tons of books on the subject, and a lot of them are pure garbage. Heres how you make a Joomla [...]]]></description>
			<content:encoded><![CDATA[<p>Joomla is a nice framework, but indeed it&#8217;s quite large and can seem cumbersome. I can&#8217;t look away from some of the redundancies and odd naming conventions, however, I don&#8217;t think it&#8217;s complicated. There are tons of books on the subject, and a lot of them are pure garbage. Heres how you make a Joomla component without the fluff. You&#8217;ll have results within a few minutes!</p>
<p><span id="more-956"></span></p>
<h3>Things We&#8217;re Not Doing</h3>
<p>I&#8217;m not telling you how to install Joomla, and I&#8217;m probably the only one that&#8217;s not going to do that.</p>
<p>We&#8217;re not going to be packaging this. Later, you can make the <code>.xml</code> and <code>.zip</code> later, use a tool to automate this, or copy the directory to other sites. Packaging is an important part of <em>long term development</em> (later).</p>
<p>Make sure you&#8217;ve got a MySQL database, and a front-end like <code>phpmyadmin</code>, <code>squirrel</code> or some other way to add a row into <code>jos_components</code>. (You can use the <code>mysql</code> client with an <code>INSERT</code> statement too)</p>
<p>We&#8217;re only making the back-end (<code>administrator/</code>) interface. You can duplicate your efforts for the front-end (<code>components/com_joombzr</code>)</p>
<h3>Inserting into MySQL</h3>
<p>Go into <code>phpmyadmin</code>, select your database, then select the <code>jos_component</code> table. In some fashion, insert something like this:</p>
<pre>INSERT INTO <code>jos_components</code> (
   <code>id</code>, <code>name</code>, <code>link</code>,
   <code>menuid</code>, <code>parent</code>, <code>admin_menu_link</code>, <code>admin_menu_alt</code>,
   <code>option</code>, <code>ordering</code>,
   <code>admin_menu_img</code>, <code>iscore</code>, <code>params</code>, <code>enabled</code>
) VALUES (
   NULL, 'JoomBzr', 'option=com_joombzr',
   '0', '0', 'option=com_joombzr', 'Site Version',
   'com_joombzr', '0',
   'js/ThemeOffice/edit.png', '0', '', '1'
);</pre>
<p>The name of my component is <em>JoomBzr</em>. You can edit this now or afterwards. I&#8217;ve messed with component names and directories a lot, and it&#8217;s pretty straight forward. I&#8217;ve renamed components, and you&#8217;ll probably do that at some time too.</p>
<h3>Creating Directories</h3>
<p>Your going to want to make this directory:</p>
<p style="padding-left: 30px;"><strong>administrator/components/com_joombzr<br />
 <span style="font-weight: normal;">This is where everything for the back-end and interface .</span></strong></p>
<p><strong><span style="font-weight: normal;">Later you&#8217;ll create one in <code>components/com_joombzr</code> for the front-end. This component only has the back-end, remember?</span></strong></p>
<p style="padding-left: 30px;"><strong><span style="font-weight: normal;"><br />
 </span></strong></p>
<h3>Creating Hello Joomla on the Back-End</h3>
<p>Create <code>administrator/components/com_joombzr/joombzr.php</code> and simply put:</p>
<pre>&lt;?php echo "Hello Joomla!";</pre>
<p>Notice there is <strong><a href="http://bit.ly/bRFLHc">no closing ?&gt;</a></strong>. This is standard practice now for PHP-only scripts. You can now navigate to this component in the back-end (<code>administrator/</code>) and select it from the <code>Components</code> menu. This will get you results within a short time. From here you can create a controller, and some models and views.</p>
]]></content:encoded>
			<wfw:commentRss>http://santiance.com/2010/04/hello-joomla-a-minimal-joomla-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Synchronize Code with Bazaar</title>
		<link>http://santiance.com/2010/01/how-to-synchronize-code-with-bazaar/</link>
		<comments>http://santiance.com/2010/01/how-to-synchronize-code-with-bazaar/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 19:00:36 +0000</pubDate>
		<dc:creator>Kristopher Ives</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Bazaar]]></category>
		<category><![CDATA[bzr]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://santiance.com/?p=672</guid>
		<description><![CDATA[Almost everyone has more than one computer, and you&#8217;ve probably got multiple machines you&#8217;ll need to synchronize your code onto.  To handle this I use Bazaar distributed version control. If you&#8217;re experienced with various VCS and are in need of convincing, see Why Switch to Bazaar? Here are the main places I have to synchronize [...]]]></description>
			<content:encoded><![CDATA[<p>Almost everyone has more than one computer, and you&#8217;ve probably got multiple machines you&#8217;ll need to synchronize your code onto.  To handle this I use <em><a title="Bazaar - Simple Distributed Version Control" href="http://bazaar-vcs.org/">Bazaar</a> </em>distributed version control. If you&#8217;re experienced with various <a title="Revision Control / Version Control System (Wikipedia)" href="http://en.wikipedia.org/wiki/Revision_control">VCS</a> and are in need of convincing, see <em><a title="Why Switch to Bazaar?" href="http://doc.bazaar.canonical.com/migration/en/why-switch-to-bazaar.html">Why Switch to Bazaar?</a></em></p>
<p>Here are the main places I have to synchronize to and the reasons for doing so:</p>
<p style="padding-left: 30px;"><strong>Linux Notebook</strong><br />
 This is where I write most of my code and I mainly use <em>Bazaar</em> here as a way to keep a changelog and sometimes revert changes. It&#8217;s also nice to be able to get some quick stats. You can also create a repository within another, for example, if some piece of code starts to grow legs of it&#8217;s own.</p>
<p style="padding-left: 30px;"><strong>Windows Machine</strong><br />
 I keep a Windows install for gaming, but I do have <a title="Eclipse Development Environment" href="http://www.eclipse.org/">Eclipse</a> and <a title="Cygwin - Linux like environment for Windows" href="http://www.cygwin.com/">Cygwin</a> installed here. I simply use <em>Bazaar</em> to check out and test my code. Windows-specific changes are usually made from here and need to make their way back to my Linux machine for further testing.</p>
<p style="padding-left: 30px;"><strong>Web Server</strong><br />
 This is where I push all my public code. For things I&#8217;ve open sourced, the address is <a title="My Source Code" href="http://bzr.santiance.com/">http://bzr.santiance.com/</a> and anyone can branch this. Release early, release often. For proprietary work this would be a private server. I authenticate via <a title="SSH File Transfer Protocol" href="http://en.wikipedia.org/wiki/SSH_file_transfer_protocol">SFTP</a>, but regular <a title="File Transfer Protocol" href="http://en.wikipedia.org/wiki/FTP">FTP</a> is also supported.</p>
<p style="padding-left: 30px;"><strong>The Public</strong><br />
 When someone makes changes to my code the way I synchronize is with <em>Bazaar</em> or a patch. Some simple changes only require a patch, but more elaborate changes warrant a merge.</p>
<p>At any time all three of these can have different copies of the code. Bazaar handles merges quite gracefully, and when there is a conflict it&#8217;s quite clear how to resolve it. Before I truly embraced this system I was able to navigate my way through armed with just the <a title="Bazaar in 5 minutes" href="http://doc.bazaar.canonical.com/latest/en/mini-tutorial/">5 minute tutorial</a>.</p>
<h3>Example</h3>
<p>I usually start by developing something on my Linux notebok, but I do the same thing from within Cygwin if I do develop something starting on a Windows machine. On Linux I keep my Eclipse projects in <code>~/workspace/</code>, and in Windows I keep them in <code>C:\cygwin\home\kris\</code>. After I&#8217;ve crafted up something I&#8217;ll create a repository and add the project files and source code then commit my changes:</p>
<pre>bzr init
bzr add src
bzr add .project
bzr commit</pre>
<p>Supply the changelog information and Bazaar will have saved this initial commit. Now I like to get my code to either the public server or private development server if the work is proprietary. I do this by:</p>
<pre>bzr push sftp://user@bzr.santiance.com/projectname</pre>
<p>One great thing about Bazaar is that you can push/pull changes from all kinds of places. If I don&#8217;t have (internet) connection to my web server, I can push/pull from my Windows and Linux machines over SFTP or a network mount. I can later push these changes back to the web server, so I get some data redundancy to help avoid losing code.</p>
<p>For clients that don&#8217;t want to use version control, which sadly do exist, you can easily take a snapshot of the code to be sent:</p>
<pre>bzr export TheProject.tar.bz2</pre>
<p>You can change the archive file type by modifying the file extension. I most commonly use <code>.tar.gz</code>, <code>.tar.bz2</code>, and <code>.zip</code> for my projects.</p>
<h3>BZR vs GIT</h3>
<p>So, why do I have a <a title="Kristopher Ives's on Github" href="http://github.com/krisives">Github account</a>? Mainly because other projects I&#8217;ve worked with use git, since most of my original work would find it&#8217;s way to <a title="Kristopher Ive's on Launchpad" href="https://launchpad.net/~kris-santiance">Launchpad</a>. Both Launchpad and Github make it easy to submit changes from the command-line once you&#8217;ve got an account. Luckily <em>Bazaar</em> has plug-ins that make working with repositories in another format much easier for us.</p>
<p>When it comes to the argument of simplicity and low barrier of entry, my hat&#8217;s off to <em>Bazaar</em>. It&#8217;s handled every scenarios I&#8217;ve thrown at it, and my projects have survived the advancement of their storage format from pre <code>1.0</code> to (now) post <code>2.0</code>. Both tools are equally capable, but <em>Bazaar</em>&#8216;s interface is more intuitive.</p>
<p>Send hate and flames <a title="Kristopher Ives on Twitter" href="http://twitter.com/kristopherives">@KristopherIves</a></p>
]]></content:encoded>
			<wfw:commentRss>http://santiance.com/2010/01/how-to-synchronize-code-with-bazaar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
