On Mar 17, 2011, at 01:24:28, Colin Barrett wrote:
> Before you do a merge or commit, use the `hg parent` command to check what 
> the parent rev of the current working directory is -- if it doesn't look like 
> tip, run an `hg up`. You can also use `hg parents` see both parents when 
> you're int he process of merging.

Some things worth noting:

- tip is not necessarily the revision you want; it's the newest revision in the 
repository, even if that's on a different branch. The latest revision on (head 
of) a given branch is identified by the branch name.
- Not only can there be multiple heads (corresponding to branches that haven't 
been closed) in the repository, a single branch can have multiple heads 
(usually because multiple people have worked on the branch in parallel). You'll 
probably want to merge the branch's heads back together, even if merging the 
branch as a whole back into the default branch is not yet warranted.

And now, some talk about tools.

First, sufficiently awesome shells can help you. Here's what I use in zsh:

Attachment: zpromptheaders.bz2
Description: BZip2 compressed data


Install as ~/.zpromptheaders and add this to ~/.zshrc:

---
. ~/.zpromptheaders
setopt PROMPT_SUBST
export PS1=$'$(svn_prompt_header || hg_prompt_header || echo ___)\n'
export RPS1='%#%~(%?)'
---

(Customize PS1 and customize or omit RPS1 to taste.)

This is what that looks like in 256-color xterm:

<<inline: zpromptheaders-256.png>>


In Terminal, it uses box-drawing characters instead of the slightly different 
background color and the underlining.

Second, I made an extension for Mercurial that adds a command to give you a 
helpful start-of-day summary. I call it report:

        https://bitbucket.org/boredzo/report-extension/

When you begin a session of working on Adium (or any other project that uses 
Mercurial), pull, then report. You'll see something like this:

> default = ssh://h...@hg.adium.im/adium-1.4
> working copy parent: 3415:07d0037572c1
> current branch: default

This thread has given me the idea to add a feature that tells you if you're 
behind on your current branch. I'll file a ticket.

Reply via email to