view session @ 12:2ddbf1893f3b draft default tip

Tweak session for Pycon lightning talk
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 29 Apr 2014 17:12:52 -0400
parents e4f64c12923c
children
line wrap: on
line source

# This talk is gonna be about a feature called "revsets". What are they?

# The Octave repo (yeah, I work on Octave)
cd ~/octave

# Let's look around
hg branches
hg bookmarks
hg log -G

# Several ways to refer to a commit
hg log -r jordi
hg log -r 18763
hg log -r fddfb3054375
hg log -r tip
hg log -r -1
hg log -r -2

# But more advanced!
hg log -r -2::-1
hg log -r .
hg log -r .~1
hg log -r .^

# Git users, I know what you're thinking...
git help revisions

# But revsets are more advanced than that. Let's take a quick peek.
# It's really its own DSL.
hg help revsets

# So last example could also have been
hg log -r 'p1(.)'

# More example, the descendant revset, combining with other revset
# functions.
hg log -r 'descendants(@)'

# Oops, let's skip @
hg log -r 'descendants(@) and not @'
hg log -r 'min(descendants(@) and not @)'
hg log -r 'reverse(descendants(@) and not @)'

# Of course, anywhere that you can fit revisions, you can also use a
# revset!
hg histedit -r 'children(@)'

# Only bisect files that touch a particular files
hg bisect --skip 'not file("jit-ir.cc")'

# In which release was histedit merged into core hg?
cd ../mercurial-source
hg log -r 'min(descendants(adds(hgext/histedit.py)) and tag())'

# Let's write our own revset!
emacs ~/revset-talk/lol.py

# And let's have fun with it
emacs ~/.hgrc

cd ../octave
hg log -r 'lol()'
hg log -r 'lol() and user(jordigh)'
!THANKS