qxt 0.5.0 April 29, 2009 No Comments

The Qxt project just released the new 0.5.0 version of their library.

Qxt offers utility classes to add functionality not readily available in the Qt toolkit.  If you do Qt development, check out the class listing for qxt and you will most likely find something that would prove useful in your Qt apps.

Check out http://libqxt.org for more information, docs, and downloads.

mercurial tasks extension March 9, 2009 20 Comments

Mercurial bookmarks offer a way to work on separate short-lived tasks in the same repo without having to create a separate clone.

For me bookmarks lack two features: tracking all changesets belonging to a particular task, and being able to push completed tasks easily while ensuring that incomplete tasks are not pushed.

I decided to try to extend the bookmarks extension into something different.  I call it ‘tasks’ and use it as my todo list.  It’s amateur python/hg and I would love some help/feedback on it.  You can see it here:  http://bitbucket.org/alu/hgtasks

Below is a similar workflow to my other post about bookmarks, except it allows me to safely push changes from one completed task while keeping my incomplete task local.


You might start off your day by looking at issues in your project tracker and creating a todo list of what issues you want to tackle. Instead of writing them on a post-it, let’s use tasks:

$ hg task issue11
$ hg task issue12
$ hg tasks
    issue11      >2:b8df77fa20d7
    issue12      >2:b8df77fa20d7

You’ll notice none of them appear “active” even though they point to the current changeset which matches our working copy. hgtasks-01

Let’s start hacking on issue11:

$ hg up issue11
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
current task: issue11
$ hg tasks
  * issue11      >2:b8df77fa20d7
    issue12      >2:b8df77fa20d7

Now that issue11 is marked as current, future commits will be applied to this task:

*hack* *hack*
$ hg ci -m"fixing issue11"
*hack* *hack*
$ hg ci -m"still fixing 11"
$ hg tasks
  * issue11       4:6c8236430e56 (2 csets)
    issue12      >2:b8df77fa20d7
$ hg task issue11 --info
task:            issue11
parent:          2:2ed12f44801b
state:           active
changesets (2):  4:31f77916d497
                 3:9ab60daf8b43

We see that we have two changesets assigned to this task.hgtasks-02 Our work on issue11 is still not finished, but issue12 has just been bumped up to high priority and we want to work on it right away leaving issue11 half done.

$ hg up -C issue12
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
current task: issue12
*hack* *hack*
$ hg ci -m"fixing issue12"
created new head
*hack* *hack*
$ hg ci -m"done fixing 12"
$ hg tasks
    issue11       4:6c8236430e56 (2 csets)
  * issue12       6:8672b6e96787 (2 csets)

hgtasks-03
Let’s mark issue12 as complete:

$ hg task issue12 -c
$ hg tasks
    issue11       4:6c8236430e56 (2 csets)
$ hg tasks --all
    issue11       4:6c8236430e56 (2 csets)
    issue12       6:8672b6e96787 (2 csets - complete)

By default, the task list will only include incomplete tasks unless we use the –all option.

We want to push this fix right away as it is high priority:

$ hg push
pushing to /some/other/repo
abort: pushing incomplete tasks
(use --all-tasks to force or --completed-tasks to prune)
$ hg push --completed-tasks
pushing to /some/other/repo
searching for completed tasks
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files

Notice that push will warn you that incomplete tasks would be pushed (this is even before the standard warning of creating additional heads on the remote repo).  So we can choose to use –all-tasks option to push everything (at which point we would be told to use –force if we really want to create new heads) or we can do what makes more sense, only push completed tasks with the –completed-tasks option. Now we can go back to working on issue11:

$ hg up -C issue11
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
current task: issue11
*hack* *hack*
$ hg ci -m"done fixing 11"
$ hg task -c issue11

Merge in changes from issue12:

$ hg merge issue12
merging file
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m"merge"

hgtasks-04
We can leave completed tasks around but if you have no reason to keep them around, might as well delete them:

$ hg task -d issue11
$ hg task -d issue12

hgtasks-05


To see more features of this extension and details on how it was implemented, check out: http://bitbucket.org/alu/hgtasks.


mercurial bookmarks February 27, 2009 4 Comments

When reading the many git-vs-mercurial blog posts I noticed lots of comments about how mercurial lacked the lightweight branching of git.  Then came a lot of rebuttals saying “well hg has bookmarks, so that’s not true anymore”.  But when I tried them, I was surprised by their behaviour.  If you had two bookmarks pointing to the same changeset, they both would move as you create new child changesets.  But with the 1.2 release of hg coming out soon, an updated version of the bookmarks extension will be included.   It has a configuration option (which I wish was the default but cannot be due to backwards compatibility) called track.current.  To enable this behaviour, you’ll need this in your rc file:

[extensions]
hgext.bookmarks =

[bookmarks]
track.current = True

Here’s a workflow that I find useful.  You might start off your day by looking at issues in your project tracker and creating a todo list of what issues you want to tackle.  Instead of writing them on a post-it, let’s use bookmarks:

$ hg bookmark issue11
$ hg bookmark issue12
$ hg bookmarks
   issue11                   216:ca8cec4bf890
   issue12                   216:ca8cec4bf890

You’ll notice none of them appear active even though they point to the current changeset which matches our
working copy.

$ hg up issue11
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg bookmarks
 * issue11                   216:ca8cec4bf890
   issue12                   216:ca8cec4bf890

hg-bo-011


Let’s start hacking on issue11,

*hack* *hack*
$ hg ci -m"fixing issue11"
*hack* *hack*
$ hg ci -m"still fixing 11"
$ hg bookmarks
 * issue11                   218:cdc9e873455d
   issue12                   216:ca8cec4bf890

At this point, we haven’t yet created a branch:
hg-bo-021


Our work on issue11 is still not finished, but we’re bored with and want to work on something else for a while. So let’s do some work on issue12:

$ hg up -C issue12
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
*hack* *hack*
$ hg ci -m"fixing issue12"
created new head
*hack* *hack*
$ hg ci -m"done fixing 12"

hg-bo-031


Now we we’re happy with our fix and are done with 12. Back to issue 11.

$ hg up -C issue11
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
*hack* *hack*
$ hg ci -m"done fixing 11"

Merge in changes from issue12, (could have done this earlier):

$ hg merge issue12
merging file
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m"merge"

hg-bo-041


We’re done with these bookmarks for now so delete them:

$ hg bookmark -d issue12
$ hg bookmark -d issue11

hg-bo-051


config extension for mercurial February 23, 2009 No Comments

I’ve written a small extension for mercurial called ‘config’.  It allows you to view and set configuration values for hg from the command-line.

Some example commands and output:

prompt> hg showconfigs
 ! /usr/etc/mercurial/hgrc
 * /etc/mercurial/hgrc
 * /etc/mercurial/hgrc.d/hgext.rc (ro)
 * /etc/mercurial/hgrc.d/mergetools.rc (ro)
 * /home/jdoe/.hgrc
 * /home/jdoe/projects/hgconfig/.hg/hgrc
prompt> hg config --verbose ui.username
values found for ui.username:
 jdoe@host  C:\Documents and Settings\jdoe\mercurial.ini
 john       d:\projects\hgconfig\src\.hg\hgrc

See more at http://bitbucket.org/alu/hgconfig/

I would appreciate feedback so please get back to me here or on bitbucket.  This is my first mercurial extension and my first python anything.