<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Michael Jay Lissner</title><link href="https://michaeljaylissner.com/" rel="alternate"></link><link href="https://michaeljaylissner.com/feeds/tag/mercurial" rel="self"></link><id>https://michaeljaylissner.com/</id><updated>2010-02-24T17:15:54-08:00</updated><entry><title>Using Revision Control on a Django Project Without Revealing Your Passwords</title><link href="https://michaeljaylissner.com/posts/2010/02/24/using-revision-control-on-a-django-project-without-revealing-your-passwords/" rel="alternate"></link><updated>2010-02-24T17:15:54-08:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2010-02-24:posts/2010/02/24/using-revision-control-on-a-django-project-without-revealing-your-passwords/</id><summary type="html">&lt;p&gt;Just a quick post today, since this took me way too long to figure out. If you have a django project that you want to share without sharing the private bits of settings.py, there is an easy way to do&amp;nbsp;this. &lt;/p&gt;
&lt;p&gt;I tried for a while to to set up mercurial hooks that would strip out my passwords before each commit, and then place them back after each commit, thus avoiding uploading them publicly. This does not work however because all of the mercurial hooks happen after snapshots of the modified files have been made. So you can edit the files using a hook, but your edits will only go into effect upon the &lt;strong&gt;&lt;em&gt;next&lt;/em&gt;&lt;/strong&gt; check in. Clearly, this will not&amp;nbsp;do.&lt;/p&gt;
&lt;p&gt;Another solution that I tried was the mercurial &lt;a href="http://mercurial.selenic.com/wiki/KeywordExtension"&gt;keyword extension&lt;/a&gt;. This could work, but ultimately it does not because you have to remember to run it before and after each commit &amp;mdash; something I know I&amp;#8217;d forget sooner or&amp;nbsp;later.&lt;/p&gt;
&lt;p&gt;The solution that &lt;strong&gt;&lt;em&gt;does&lt;/em&gt;&lt;/strong&gt; work is to split up your settings.py file into 
multiple pieces such that there is a private file and a public file. I 
followed the instructions &lt;a href="http://code.djangoproject.com/wiki/SplitSettings#UsingalistofconffilesTransifex"&gt;here&lt;/a&gt;, with the resulting code looking being 
checked in &lt;a href="https://github.com/freelawproject/courtlistener/blob/master/alert/settings.py"&gt;here&lt;/a&gt; and &lt;a href="https://github.com/freelawproject/courtlistener/blob/master/alert/settings/10-public.py"&gt;here&lt;/a&gt;. There is also a file called 
&amp;#8220;20-private.py&amp;#8221; which is not uploaded publicly, and which contains all the 
private bits of code that would normally be found in settings.py. Thus, all of 
my settings can be found my django, but I do not have to share my private&amp;nbsp;ones.&lt;/p&gt;</summary><category term="settings.py"></category><category term="revision control"></category><category term="Python"></category><category term="mercurial"></category><category term="django"></category><category term="Final Project"></category></entry><entry><title>How to Protect Your Open Source Code from Theft and a Mercurial Hook to Help</title><link href="https://michaeljaylissner.com/posts/2010/01/15/how-to-protect-your-open-source-code-from-theft-and-a-mercurial-hook-to-help/" rel="alternate"></link><updated>2010-01-15T10:27:18-08:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2010-01-15:posts/2010/01/15/how-to-protect-your-open-source-code-from-theft-and-a-mercurial-hook-to-help/</id><summary type="html">&lt;p&gt;&lt;strong&gt;Updated, 2010-01-24:&lt;/strong&gt; Some edits regarding the Affero license (thanks to
Brian at &lt;a href="http://cyberlawcases.com/"&gt;http://cyberlawcases.com&lt;/a&gt; for the&amp;nbsp;corrections).&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve finally begun doing some of the actual coding for &lt;a href="http://www.ischool.berkeley.edu/programs/masters/projects/2010/judicialnlp"&gt;my final 
project&lt;/a&gt; so the time has come to set up &lt;a href="https://github.com/freelawproject/courtlistener"&gt;a mercurial repository&lt;/a&gt; to 
hold the&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;Once we complete our project, we will have built a free product that 
competes with some of the core functionality of both LexisNexis and 
Westlaw, so something we wanted to do was make sure they couldn&amp;#8217;t steal our
code, enhance their product and thus moot&amp;nbsp;ours.&lt;/p&gt;
&lt;p&gt;To achieve this, we&amp;#8217;re using the &lt;a href="http://www.gnu.org/licenses/agpl.html"&gt;&lt;span class="caps"&gt;GNU&lt;/span&gt; Affero General Public License 
v3&lt;/a&gt;, which allows people to take our code for free, but requires that they 
publicly share any modifications that they make to the code. The normal &lt;span class="caps"&gt;GNU&lt;/span&gt; 
General Public License allows the code to be used at no cost, 
but only requires that changes to the code be shared with the public if one
distributes the changed version to the public. With a server-based 
project, like ours, one could operate modified versions of the code 
without ever having a need to distribute any of the software to the public. 
This loophole is closed by the Affero&amp;nbsp;license.&lt;/p&gt;
&lt;p&gt;In order to license our work, we must be its copyright holder. This is easy
enough, since we get copyright instantly in the U.S., but, 
as has been demonstrated in &lt;a href="http://en.wikipedia.org/wiki/Jacobsen_v._Katzer"&gt;Jacobsen v. Katzer&lt;/a&gt;, in order to seek remedies 
for copyright violations, we would have to register everything we made with 
the copyright office. This &lt;a href="http://www.copyright.gov/docs/fees.html"&gt;costs $35&lt;/a&gt; per registration, 
and with open source software, it&amp;#8217;s not clear whether each and every 
version needs to be registered or just major releases, or&amp;nbsp;what. &lt;/p&gt;
&lt;p&gt;Since this is too onerous to be practical, an additional approach to 
protecting our works is useful, and in the &lt;span class="caps"&gt;DMCA&lt;/span&gt; (&lt;a href="http://www.copyright.gov/title17/92chap5.html#506"&gt;17 &lt;span class="caps"&gt;U.S.C.&lt;/span&gt;§ 506(d)&lt;/a&gt;), 
remedies are provided for the &amp;#8220;fraudulent removal of copyright notice.&amp;#8221; 
Although these do not (in any way) match the protections provided by normal
copyright registration, they are a useful place to begin. Thus, 
if we place a copyright notice into each file of our code, 
those using our code must either risk violating the &lt;span class="caps"&gt;DMCA&lt;/span&gt; by removing these
notices, or leave our copyright information intact. (Placing such notices
in each file is also &lt;a href="http://www.fsf.org/licensing/licenses/gpl-howto.html"&gt;the recommendation&lt;/a&gt; of the Free Software&amp;nbsp;Foundation.)&lt;/p&gt;
&lt;p&gt;To place our information into each and every file of code that we upload 
publicly, I wrote &lt;a href="https://michaeljaylissner.com/archive/checklicense.py"&gt;a short mercurial hook&lt;/a&gt; that  adds copyright and 
licensing information it to the top of every file that is modified or added 
to the repository. To use the script, simply make it executable, 
place it in the .hg directory of your project, and add the following lines
to&amp;nbsp;.hg/hgrc:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;[hooks]
pretxncommit = .hg/checklicense.py
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;A couple of things I should note about this script is that it currently 
only checks for java and python files, and that it requires files called 
java_license.txt and python_license.txt to be in the root of your 
repository. It should be fairly easy to modify though to fit your own&amp;nbsp;needs.&lt;/p&gt;</summary><category term="mercurial"></category><category term="hook"></category><category term="Final Project"></category><category term="DMCA"></category><category term="copyright"></category><category term="Affero GPLv3"></category><category term="CourtListener"></category></entry></feed>