arch detail

arch detail

Monday, August 28, 2006

HOWTO: Subversion over SSH with different usernames

I was recently faced with the problem of needing to check out a Subversion repository on a machine where I had one username onto a machine where I had another.

This was deceptively difficult.

The problem is, svn checkout has a --username ARG option, but that only applies to Subversion. We use svn+ssh:// for security.

I tried the obvious things - svn+ssh://[user]@[host], etc - but nothing worked. After butting my head for a while, I decided to actually read up on how to do this.

Well, Subversion will let you define your own tunnelling protocol if you define the programs which they use. The trick is this: In your ~/.subversion/config, create an entry along these lines:

dummyssh = dummyssh

Then create a BASH script somewhere in your path called dummyssh and make it executable. The script should basically be this:

#!/bin/bash
ssh -l [your username] $*

Now you just do

svn checkout --username svn+dummyssh://[host]

And you can pull it off.

I have to admit, I wish the Subversion manual included this information. Hope somebody finds it useful.

LISP as an XML Replacement

This discussion deserves much more attention. Particularly on my part.

The abstract version: you think LISP is a pain? Actually, XML is a lot *more* painful, and we use it when we *should* use LISP, because people are terrified of LISP.

Prof. Salter at my alma mater, Oberlin College, made a big deal about Scheme. Nobody much appreciated it at the time, but I took his pet class, Programming Languages, my senior year, and when it came time to write some compilers in a hurry, it was amazing how after staring at the screen long enough, enlightenment came and the code would just write itself. It was enough to make me a believer.

Tragically, LISP is not Scheme, but if I can get that experience when trying to deal with actual real-life problems (like the ones XML seeks to solve) I'd be willing to learn.

The Joy of Eshell

Fellow emacsers:

Today I got embarassed because Friday at work I'd used M-x shell in front of a coworker to commit a source change to Subversion. Emacs' shell doesn't hide passwords, so I unintentionally typed mine in plain-text... in front of someone I would like to actually impress.

Whoops.

Naturally, this morning, I decided to see if anyone had though to deal with this problem, and I discovered Linkeshell which has actually been part of emacs since v. 21. Just run M-x eshell.

There are quite a few things that make eshell different than having emacs open a shell inside of its goofy psuedo-terminal buffer. First of all, it's actually a shell. Just for emacs. Written in elisp. Here are some highlights:
  • you can redirect stdout to an emacs buffer. Try env > # <buffer scratch>
  • it can be used anywhere that can run emacs, e.g. Win32, or DOS, or a good toaster. Now you don't have to install BASH on Windows to use your Windows box like a Real Computer.
  • your aliases are automatically saved between sessions.
  • you can use emacs functions like shell commands! Try alias emacs="find-file $1" for an experience in silky-smoothness.
  • up and down arrows behave like most shells, cycling through your history. However, left and right arrow allow you place the cursor *behind* the prompt and select text from the output of your last command. I've been looking for this feature in a shell for years now. Eshell makes it easy to copy, say, the PID from a ps and paste it into a "kill."
  • it's elisp, so it's easily configurable and extensible.
There are some problems - see the wishlist on the wiki. Doing a for loop into a pipe doesn't really work correctly. But that's what BASH one-liners are for.