shell
Doug Hellmann: Shell history, jigs, & subversion
@import url('http://www.blogger.com/css/blog_controls.css');
@import url('http://www.blogger.com/dyn-css/authorization.css?targetBlogID=5440028356946346379');
#navbar-iframe { display:block }
skip to main |
skip to sidebar
Doug Hellmann
Code Interstices
All the little things that happen between bouts of coding. Covering internet technologies, Python, Mac OS X, and open source.
Sunday, April 13, 2008
Shell history, jigs, & subversion
Everyone else is showing theirs, so here's mine:$ history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s\n",a[i],i}}'|sort -rn|head 162 svn 99 ls 80 rtop 69 sudo 63 cd 55 dotest 51 workon 23 make 21 close_branch 21 cl2svnSoftware Jigs:Does it say anything in particular about me that half of those commands are aliases or scripts I or my co-workers have created to wrap up other tools?rtop - is a bash alias to change directory to the top of sandbox. I have an environment variable pointing there, too, but I guess I don't like typing $.dotest - is an alias to run tests with our tracing module turned on, preserving the output in the same log file each time. We have a very verbose trace module that prints function inputs and outputs as our program executes. It is superior to logging for low-level debugging, but entirely unsuitable for production use (it's easy to turn on and off).workon - is a shell function that swaps out different sandboxes so I can work on multiple branches on the same system. Our test framework requires an installed version of the whole system, unfortunately, and I don't like to mix patches from multiple branches by copying files into the install tree. Running workon rearranges symlinks so I can replace the install tree with the build tree from my sandbox of choice. Shell functions are an under-appreciated implementation technique for something that has to operate on the current environment (workon changes directory to the new sandbox) but is more complicated than what would fit in an alias.close_branch - is a bash script that takes a short branch name and deletes the branch and any "rebase" branches based on it using the long URL. We have a whole set of little scripts like this that we've written in house.cl2svn - finds changes in ChangeLog files in my svn sandbox, extracts the new messages, and produces a single (sorted) output list formatted nicely to show up in trac. We use ChangeLog files and trac commit messages as part of the documentation for our code review process, so having everything formatted nicely is important. I used to do this by hand, but after one particularly large changeset I came up with this Python app to do the work for me.Wrapping Subversion:I mentioned close_branch as a subversion wrapper. There's a make_branch script, too, to save from making typos in long URLs. Another shell function, mksbox, finds a free sandbox in my pool and switches it to use a particular branch. Our build tree is pretty large, so it is way more efficient to just keep a bunch of sandboxes around and switch them to point to different branches with "svn switch" instead of checking out a full copy every time.My favorite, though, is merge_branch, which figures out the start point of a svn branch and merges all of the changes from that branch into the current sandbox. I'm a little surprised that make_branch and merge_branch didn't show up higher in the list, but they're in the top 20.We wrote these wrapper scripts a couple of years ago, when we switched from CVS to svn. We had similar tools for CVS, but branching worked differently and we didn't use branches as often then. Now every ticket gets its own branch, so managing branches is a daily operation. A typical development cycle for me looks something like this:$ make_branch 6583 # that's a trac ticket number$ mksbox 6583 # automatically does a workon for that sandbox$ dcctl restart # restart our daemon services to pick up the sandbox change# add feature or remove bug# update ChangeLog files$ cl2svn | tee changes.txt$ svn commit -F changes.txt# request code review for changeset$ prepare4commit.sh # switch current sandbox to trunk & merge in the branch$ docommit # commit, using the first line of changes.txt for log message$ close_branch 6583 # clean up after myselfWhen we switched off of CVS, we had some particular needs that weren't met by svn directly (especially the way we do code reviews). There are a whole host of tools for wrapping svn out there now. sv-subversion looks interesting, but I haven't tried it. If our code didn't make assumptions about the install path, we could probably just use DivmodCombinator, which looks like it has a lot of the features we've rolled ourselves, but the inertia for changing now is pretty high, and the benefits aren't great enough.
Posted by
Doug Hellmann
at
8:34 AM
Labels:
blogging,
programming,
python
0
comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Subscribe
Contact me at: doug dot hellmann at gmail dot com
Links
My Projects
Python Magazine
CastSampler.com
Grocerific.com
My O'Reilly Profile
Link Blog
Del.icio.us
Blog Archive
▼
2008
(35)
▼
April 2008
(9)
Python Magazine for April 2008
PyMOTW: filecmp
tools for literate programming with Python?
PyMOTW: fnmatch
Shell history, jigs, & subversion
New release: virtualenvwrapper
One year of "The Python Module of the Week"
PyMOTW: operator
Site outage, should be ok now
►
March 2008
(6)
PyMOTW: urllib
PyMOTW: collections
Which module should I write about next?
PyMOTW: datetime
PyMOTW: time
PyMOTW: EasyDialogs
►
February 2008
(8)
PyMOTW: imp
February issue of Python Magazine now available
PyMOTW: pkgutil
Testing Python Linters
Python Bug Day
PyMOTW: tempfile
AstronomyPictureOfTheDay 3.0
PyMOTW: string
►
January 2008
(12)
Back issues of Python Magazine
ProctorTicket
PyMOTW: os.path
PyCon 2008
January issue of Python Magazine now available for...
PyMOTW: hashlib
Django with PostgreSQL on Mac OS X Leopard
Python development tools you can't live without
PyMOTW: threading
January PyATL Meetup
PyMOTW: weakref
import export
►
2007
(139)
►
December 2007
(19)
Django with PostgreSQL on Mac OS X Tiger
Python Magazine "wish list" updated
PyMOTW: mmap
Using raw SQL in django
Book Review: The Definitive Guide to Django
Python Magazine for December available for downloa...
This Week in Django - Podcast
PyMOTW: zipimport
Adam Gomaa explains why I prefer Django to Turbo G...
new statistics package for python: python-statlib
two new releases
PyMOTW: zipfile
I download all the Python Cookbook recipes » jesse...
Racemi Now Hiring Python developers
PyMOTW: BaseHTTPServer
►
November 2007
(25)
►
October 2007
(12)
►
September 2007
(8)
►
August 2007
(11)
►
July 2007
(9)
►
June 2007
(8)
►
May 2007
(12)
►
April 2007
(7)
►
March 2007
(9)
►
February 2007
(6)
►
January 2007
(13)
►
2006
(23)
►
December 2006
(23)
Labels
AppleScript
(11)
astronomy
(3)
AstronomyPictureOfTheDay
(3)
Automator
(3)
BlogBackup
(3)
blogging
(13)
books
(8)
calendar
(2)
CastSampler
(6)
CherryPy
(1)
codehosting
(7)
CommandLineApp
(2)
csvcat
(1)
django
(21)
django-links
(2)
email
(6)
feedcache
(5)
GHOP
(7)
HappyDoc
(1)
lifehack
(1)
LinkingToMe
(2)
MailArchiveByDate
(4)
mailbox2ics
(1)
opensource
(6)
OS X
(15)
OSS
(3)
podcasting
(5)
politics
(1)
PostgreSQL
(1)
Proctor
(4)
programming
(6)
PyATL
(11)
PyCon
(2)
PyMOTW
(65)
python
(148)
Python Magazine
(16)
PyUGraph
(1)
spam
(2)
sql
(4)
svnbackup
(2)
telecommuting
(1)
testing
(6)
UI
(1)
usability
(2)
virtualenvwrapper
(1)
visualization
(5)
Zope/Plone
(1)
разделы
ванна моечный
измеритель петля фаза нуль
медикаментозный прерывание беременность
sharp ar-m205
измеритель фаза нуль
девелоперская компания
электроинструмент метабо
софт автошкола
ваттметр
сбор д/полоскания горло зубной боль
li-da
центр консультирование
1000 холодильник
перевод денег
корпаративные праздник
узи тошиба
dhl
1000 холодильник
купить ниппель
луковичный цвет
силикон
газонокосилка dolmar
срок реализация рак
nokia 3230 купить
плата видеозахвата
огнезащитный состав
прайс зеркало
тройник перех
шампанский заказ
диспетчеризация
сенсорный дисплей
фосфорный краска
диспорт
nokia 3230 купить
билет хоккей
электро лаборатория
теплолюкс
бордюр обоев
вытяжка крона
купить ниппель
фасадный покрытие
лечение иглоукалыванием
лакокраска
фирменный флаг
фасадный покрытие
имплантат
подбор холодильный камера
автоматический оповещение
восстановление бухучета
рукавичка доставка
mobil cut
метрореклама нижнийновгород
ротационный rvg
билет хоккей
лечение зарубежом
грунт стяжка
теннисный ракетка
сварочный пост
международный конкурс дебютант
химчистка доставка
профиль salamander
сервер hp
доставка ноутбук
автоматический оповещение
варочный поверхность cata
беседка
видеорегистраторы
пежо 407
автоматический резка
гуп ритуал
тренировка память
любимый цвет
безоперационное прерывание беременность
кулер бесшумный
анкетирование
лакокраска
диспетчеризация
болен алкоголизмом
искать фотограф
меховой холодильник
lida
время ярославль
венеролог
shell