mercurialhg-log

Mercurial - hg log for just two changesets?


The command hg log -v -r 2:5 can be used to see details on changesets 2/3/4/5 - is there a similar way you can view changeset details on JUST changesets 2 and 5?


Solution

  • Use separate -r specifiers:

    hg log -v -r 2 -r 5
    

    It will give you the log entries in the same order you specify rev numbers.

    Here's a test which demonstrates this:

    mkdir hgTest; cd hgTest; hg init; echo "0" > 0.txt; hg addremove; hg commit -m "Added file 0.txt"; echo "1" > 1.txt; hg addremove; hg commit -m "Added file 1.txt"; echo "2" > 2.txt; hg addremove; hg commit -m "Added file 2.txt"
    

    Now run hg log -v -r 0 -r 2 in the hgTest directory, and you'll see:

    changeset:   0:22deafd4b5da
    user:        aUser
    date:        Fri Mar 25 17:37:01 2011 +0000
    files:       0.txt
    description:
    Added file 0.txt
    
    
    changeset:   2:39fedf6f9f56
    tag:         tip
    user:        aUser
    date:        Fri Mar 25 17:37:01 2011 +0000
    files:       2.txt
    description:
    Added file 2.txt
    

    Notice there's no mention of the file 1.txt which was added in revision 1.