== Developer Basics == This page has some basic code examples to get you started hacking on hg. See also MercurialApi. === Looking at changesets === Here's some simple code to look at a [[ChangeSet|changeset]]: {{{#!python from mercurial import ui, hg u = ui.ui() # get a ui object r = hg.repository(u, ".") # get a repo object for the current directory c = r.changectx("tip") # get a context object for the "tip" revision # show some information about the changeset print c # represented as the changeset hash print c.user() print c.description() print # let's take a peek at the files files = c.files() for f in files: fc = c[f] print " ", f, len(fc.data()) }}} And the output looks like this: {{{ $ python lc.py 534ec2689c94 Matt Mackall copy: more cleanups - remove copyfile src variable - add some comments - simplify actual copy logic - simplify 'undelete' logic - make the error counting actually work mercurial/cmdutil.py 41944 }}} ---- CategoryDeveloper