<?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>traviscline.com</title>
	<atom:link href="http://traviscline.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://traviscline.com/blog</link>
	<description>/blog</description>
	<lastBuildDate>Wed, 27 Jul 2011 21:23:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Moving PostGIS databases between machines</title>
		<link>http://traviscline.com/blog/2010/04/28/moving-postgis-databases-between-machines/</link>
		<comments>http://traviscline.com/blog/2010/04/28/moving-postgis-databases-between-machines/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 14:07:55 +0000</pubDate>
		<dc:creator>tclineks</dc:creator>
				<category><![CDATA[postgis]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://traviscline.com/blog/?p=48</guid>
		<description><![CDATA[PostGIS is really, really fantastic software. I love it. Pair it with GeoDjango to smooth out the api and you have lots of power in your hands. On unfortunate side effect of how PostGIS is implemented is that you end up with absolute filesystem path references in your databases. This makes moving a database between [...]]]></description>
			<content:encoded><![CDATA[<p>PostGIS is really, really fantastic software. I love it.<br />
Pair it with GeoDjango to smooth out the api and you have lots of power in your hands.</p>
<p>On unfortunate side effect of how PostGIS is implemented is that you end up with absolute filesystem path references in your databases.  This makes moving a database between machines a pain.</p>
<p>I often run into the need to move databases between machines as I prefer to mirror the production stack as closely as reasonably possible on my local machine.  Making a copy the database on the remote cluster and tunneling is an option but can be slow if you aren&#8217;t on a nice pipe. </p>
<p>My solution is essentially a selective restore of the dump file.  If we only restore the items that have been added to the database beyond the initial PostGIS items then we can load the dump into another fresh postgis database.</p>
<p><a href="http://www.postgresql.org/docs/8.4/interactive/app-pgrestore.html">pg_restore</a> has two flags that will be useful:</p>
<ul>
<li>-l: List the contents of the archive. The output of this operation can be used with the -L option to restrict and reorder the items that are restored.</li>
<li>-L list-file: Restore elements in list-file only, and in the order they appear in the file.</li>
</ul>
<p>How handy.</p>
<p>Note: These options are only available if you have a Postgres formatted dump, you can create one of these with the -Fc option to pg_dump.  Also be aware that crossing Postgres versions with these can sometimes break.</p>
<p>Here&#8217;s a little script I hacked together that will give you the list of items in one Postgres dump but not the other.  Given the template_postgis dump file and the dump of your populated database you can generate the list of items that have been added to the populated database beyond the initial PostGIS items. Once you have this then loading the dump should proceed smoothly on any fresh PostGIS database. Awesome.</p>
<p>See help text inline for more info:<br />
<script src="http://gist.github.com/380278.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://traviscline.com/blog/2010/04/28/moving-postgis-databases-between-machines/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using hg-git to work in git and push to hg</title>
		<link>http://traviscline.com/blog/2010/04/27/using-hg-git-to-work-in-git-and-push-to-hg/</link>
		<comments>http://traviscline.com/blog/2010/04/27/using-hg-git-to-work-in-git-and-push-to-hg/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 15:53:23 +0000</pubDate>
		<dc:creator>tclineks</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[hg]]></category>

		<guid isPermaLink="false">http://traviscline.com/blog/?p=37</guid>
		<description><![CDATA[update: hg-git init&#8217;s a bare repo, for now create your .git with `git init` (assuming intree, see below) before `hg gexport`. hg-git is a fantastic project by GitHub&#8217;s Scott Chacon that allows bidirectional communication between Mercurial and Git. Most of the documentation is angled towards hg users contributing to git projects but being more in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>update</strong>: hg-git init&#8217;s a bare repo, for now create your .git with `git init` (assuming intree, see below) before `hg gexport`.</p>
<p><a href="http://hg-git.github.com/">hg-git</a> is a fantastic project by GitHub&#8217;s <a href="http://scottchacon.com/">Scott Chacon</a> that allows bidirectional communication between Mercurial and Git.</p>
<p>Most of the documentation is angled towards hg users contributing to git projects but being more in the git camp I have the reverse use for it.</p>
<p>Here are the basic steps I follow to get set up to work with git on an hg project.</p>
<p>First, we need a mercurial checkout. I&#8217;m going to use <a href="https://pyglet.googlecode.com/">pyglet</a> &#8211; an awesome little python windowing and graphics library.  Some little play code I have uses it and the cocoa backend needs some love (diving head first into PyObjC has been.. interesting).</p>
<p>I&#8217;ll assume you have hg-git installed and enabled in your ~/.hgrc<br />
$ <code>hg clone https://pyglet.googlecode.com/hg/ pyglet</code></p>
<p>The basic operation to generate a git repository and convert hg commits to git commits is <code>gexport</code>.  This will create refs in the git repo for each hg bookmark that exists. Hg bookmarks are essentially equivalent to git branches &#8212; named pointers to commits that move when new child commits are created. See <a href="http://mercurial.selenic.com/wiki/BookmarksExtension">http://mercurial.selenic.com/wiki/BookmarksExtension</a> for more info.</p>
<p>Before we create the git repo let&#8217;s create bookmarks for the hg branches we would like to interact with in git (this can be done after the initial gexport as well).<br />
$ <code>hg bookmark hg/default -r default</code><br />
$ <code>hg bookmark hg/cocoa-port -r cocoa-port</code></p>
<p>I&#8217;m prefixing the refs with hg so we have slight namespace separation between our git branches and the refs that are updated with <code>gexport</code></p>
<p>Ok. Let&#8217;s go ahead and create the git repo:<br />
$ <code>hg gexport</code></p>
<p>This can take some time with a large repo (and pyglet&#8217;s repo isn&#8217;t tiny) but almost all of the cost is one-time. This takes a little under 10 minutes on my machine.</p>
<p>By default <code>gexport</code> will create the git repo at .hg/git.  I prefer my .git and .hg directories to live side-by-side. Just simply symlink the .git repo into the right place:</p>
<p>$ <code>ln -s .hg/git .git</code></p>
<p>(You can make this the default behavior, see [1] below.)</p>
<p>From here let&#8217;s create a branch corresponding to the &#8220;hg&#8221; branch:<br />
$ <code>git branch cocoa-port hg/cocoa-port</code></p>
<p>And make our master the same as hg/default:<br />
$ <code>git reset hg/default</code></p>
<p>From here you can make commits on your git branches and pull them into your hg repo with:<br />
$ <code>hg gimport</code></p>
<p>Subsequent pulls/fetches and gexport calls will push new commits to the hg/ refs in git.</p>
<p>There you go! A push from there would get your git commits to your remote hg repo. You&#8217;re set up to work with git and publish to hg!</p>
<hr />
<p>One annoyance you&#8217;ll likely notice is the issue of the .hg and .git directories showing up in git status and hg status repectively.</p>
<p>To hide .hg from git simply:<br />
$ <code>echo ".hg" &gt;&gt; .git/info/exclude</code></p>
<p>Unfortunately Mercurial doesn&#8217;t have quite as flexible of a local ignore file but we can get part of the way there with:<br />
$ <code>echo "[ui]<br />
ignore = `pwd`/.hg/hgignore" &gt;&gt; .hg/hgrc</code><br />
and then:<br />
$ <code>echo ".git" &gt;&gt; .hg/hgignore</code><br />
The absolute path is required here for the ignore to work throughout the repository, unfortunately.</p>
<hr />
<p>Here&#8217;s that again with less jabber:</p>
<p>$ <code>hg clone https://pyglet.googlecode.com/hg/ pyglet</code><br />
$ <code>hg bookmark hg/default -r default</code><br />
$ <code>hg bookmark hg/cocoa-port -r cocoa-port</code><br />
$ <code>hg gexport</code><br />
(wait)<br />
$ <code>ln -s .hg/git .git</code><br />
$ <code>git branch cocoa-port hg/cocoa-port</code><br />
$ <code>git reset hg/default</code><br />
(hack, commit)<br />
$ <code>hg gimport</code><br />
$ <code>hg push</code></p>
<p>To set up ignores:<br />
$ <code>echo ".hg" &gt;&gt; .git/info/exclude</code><br />
$ <code>echo "[ui]<br />
ignore = `pwd`/.hg/hgignore" &gt;&gt; .hg/hgrc</code><br />
$ <code>echo ".git" &gt;&gt; .hg/hgignore</code></p>
<hr />
<p>Addendum</p>
<ol>
<li>You can change hg-git&#8217;s default behavior by adding this section to your ~/.hgrc:<br />
<code>[git]<br />
intree=1<br />
</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://traviscline.com/blog/2010/04/27/using-hg-git-to-work-in-git-and-push-to-hg/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Djangocon Ho!</title>
		<link>http://traviscline.com/blog/2008/09/04/djangocon-ho/</link>
		<comments>http://traviscline.com/blog/2008/09/04/djangocon-ho/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 00:07:37 +0000</pubDate>
		<dc:creator>tclineks</dc:creator>
				<category><![CDATA[Django]]></category>

		<guid isPermaLink="false">http://traviscline.com/blog/2008/09/04/djangocon-ho/</guid>
		<description><![CDATA[Flying out of KCI in 12 hrs woohoo! update 09/04/2009: Leaving shortly for Seattle and then to Portland for Djangocon, woo!]]></description>
			<content:encoded><![CDATA[<p>Flying out of KCI in 12 hrs woohoo!</p>
<p><strong>update 09/04/2009:</strong> Leaving shortly for Seattle and then to Portland for Djangocon, woo!</p>
]]></content:encoded>
			<wfw:commentRss>http://traviscline.com/blog/2008/09/04/djangocon-ho/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>django middleware: session backed messaging</title>
		<link>http://traviscline.com/blog/2008/08/23/django-middleware-session-backed-messaging/</link>
		<comments>http://traviscline.com/blog/2008/08/23/django-middleware-session-backed-messaging/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 22:27:02 +0000</pubDate>
		<dc:creator>tclineks</dc:creator>
				<category><![CDATA[Django]]></category>

		<guid isPermaLink="false">http://traviscline.com/blog/2008/08/23/django-middleware-session-backed-messaging/</guid>
		<description><![CDATA[This basically takes the ideas from the patches on ticket 4604 but puts them into middleware instead of aiming at a modification to core.

<a href="http://www.djangosnippets.org/snippets/1002/">DjangoSnippet 1002</a>

I added message types as well:

<img src="http://traviscline.com/blog/wp-content/uploads/2008/08/notifications-example.png" alt="notifications-example.png" />]]></description>
			<content:encoded><![CDATA[<p>This basically takes the ideas from the patches on ticket 4604 but puts them into middleware instead of aiming at a modification to core.</p>
<p><a href="http://www.djangosnippets.org/snippets/1002/">DjangoSnippet 1002</a></p>
<p>I added optional message type passing so you can display them differently.</p>
<p><img src="http://traviscline.com/blog/wp-content/uploads/2008/08/notifications-example.png" alt="notifications-example.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://traviscline.com/blog/2008/08/23/django-middleware-session-backed-messaging/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

