[Ur] PATCH: add an URWEB_PQ_CON environment variable to override PostgreSQL connection string

austin seipp as at hacks.yi.org
Sat Sep 24 16:51:15 EDT 2011


On Sat, Sep 24, 2011 at 1:08 PM, Adam Chlipala <adamc at impredicative.com> wrote:
> austin seipp wrote:
>>
>> The following changeset implements a very simple patch to the
>> PostgreSQL backend that lets you override the compiled-in '-db' option
>> at runtime with the URWEB_PQ_CON environment variable:
>>
>> https://bitbucket.org/thoughtpolice/urweb/changeset/173d3cdc5bf9
>>
>> It's on the 'psql-env-var' branch as you can see here:
>>
>> https://bitbucket.org/thoughtpolice/urweb/changesets
>>
>
> I've pushed the changeset to the main repo.  Thanks for contributing it!
>
> It wasn't clear to me how to get the changeset without exporting it
> individually from the former URL.  You've put it in a branch, and I don't
> want to "infect" my repo with branches; I prefer to use separate repos for
> parallel versions of the code.  Perhaps I just misunderstand a common
> pattern of Mercurial usage.

Thanks! I actually don't know what the 'traditional' way of doing
branching/merging in Mercurial is either; there seem to be lots of
options (repo per fork? named branches? bookmarks?) so I just stuck
with named branches, since they seemed closest to the git tradition.

Some digging around shows that mercurial ships a 'transplant'
extension, which should effectively allow you to pick a commit out of
a branch and apply it to another branch without the 'merge' noise. The
documentation is here:

http://mercurial.selenic.com/wiki/TransplantExtension

So if you grab my named branch, I think you could just be in your
'default' branch and transplant it. I just tested this with a copy of
the Ur/Web repo and a different branch and it seems to work as
expected:

$ cat >> ~/.hgrc # enable 'transplant'
[extensions]
transplant =
$ hg pull --branch foobranch https://bitbucket.org/thoughtpolice/urweb
# grab my remote branch, get it in your repo
$ hg update default # make sure you're on your own default branch
$ hg transplant --branch psql-env-var
...
$ hg update foobranch
$ hg commit --close-branch

This will pull my repo, transplant the changes, and then finally you
close the branch so it no longer shows up when you run 'hg branch'
(doesn't really matter what's in the commit msg.) If there's a
conflict during transplant you need to fix it and then do 'hg
transplant --continue' and it'll finish it.

I think this should work pretty well for most patches. If that works
for you then I'll stick to using named branches and sending requests
for you to transplant the branch.

-- 
Regards,
Austin



More information about the Ur mailing list