Differences between revisions 15 and 16
Revision 15 as of 2009-04-27 07:51:19
Size: 4358
Comment: Fix formatting, add some parentheses.
Revision 16 as of 2009-05-04 20:43:58
Size: 4511
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
 * util.Popen3 is gone, use subprocess instead
 * util.md5 is gone, use sha1 to get a secure hash function or keepalive.md5 if you really must use MD5

Because Mercurial's internals are steadily evolving to be simpler and more consistent, we have not yet provided a guaranteed-stable API. This page describes Mercurial internal changes on the development branch to help third-party developers update their code.

Changes from 1.2 to 1.3

  • we've dropped Python 2.3 compatibility
  • util.set() is now just set()
  • util.sort() is replaced by the sorted() built-in
  • util.Popen3 is gone, use subprocess instead
  • util.md5 is gone, use sha1 to get a secure hash function or keepalive.md5 if you really must use MD5
  • the ui object constructor has been simplified:

    # before
    ui = ui.ui(parentui=parentui, interactive=False)

    # after
    ui = baseui.copy() # there's no longer a parent/child concept
    ui.setconfig('ui', 'interactive', 'off')
  • Some methods relating to configuration have been removed from the ui object.
  • util.configparser replaced by config.config
  • __getattr__ caching tricks replaced by @util.propertycache tricks

  • cmdutil.setremoteopts(ui, opts) is now cmdutil.remoteui([repo|ui], opts)
  • ui.interactive is now a method
  • ui.readsections() is now ui.readconfig(sections=[])
  • ui.print_exc() is renamed ui.traceback()
  • must explicitly call lock.release()
  • encoding functions moved to new encoding module

Changes from 1.1 to 1.2

  • Most exceptions are now defined in error.py and some exception names have changed
  • Version info is now retrieved with util.version(), version.py is removed

Changes from 1.0 to 1.1

  • repo.count(), changelog.count(), and revlog.count() replaced with len() method
  • introduction of repo[identifier] and revlog[identifier]
  • replace all users of util.matcher with match objects
  • changed cmdutil.walk to repo.walk:

    # before
    for src, abs, rel, exact in cmdutil.walk(repo, pats, opts,
                                             node=ctx.node()):

    # after

    m = cmdutil.match(repo, pats, opts)
    for abs in ctx.walk(m):
        rel = m.rel()
  • changed defaults for localrepo.status:

    # before
    def status(self, node1=None, node2=None, files=[], match=util.always,
               list_ignored=False, list_clean=False, list_unknown=True):

    # after
    def status(self, node1='.', node2=None, match=None,
               ignored=False, clean=False, unknown=False):
  • patch.diff() no longer accepts an fp argument, it yields data instead
  • len(changectx.parents()) may now be of length 1 (but never length 0)
  • revlog.linkrev() now takes a numerical rev argument rather than a node:

    # before
    a = manifest.linkrev(node)
    b = manifest.linkrev(manifest.node(rev))

    # after
    a = manifest.linkrev(manifest.rev(node))
    b = manifest.linkrev(rev)
  • cset_printer() and cset_templater() now take a changectx instead of rev or node:

    # before
    displayer = cmdutil.show_changeset(ui, repo, opts)
    displayer.show(rev, node)

    # after
    displayer = cmdutil.show_changeset(ui, repo, opts)
    displayer.show(repo[rev]) 
  • patch.patchfile now expects a fifth argument, 'opener'
  • patch.applydiff's argument 'changes' constructs a new dict:

    # before
    keep = { }
    patch.applydiff(..., keep, ...)
    
    print keep
    { 'fname': ( action, other ) }

    # after
    keep = { }
    patch.applydiff(..., keep, ...)
    
    print keep
    { 'fname': action }

as before, action will only be set to anything not-None if the patch is in git-format.

  • hgweb() and hgwebdir() now return an iterator over bytes rather than writing to the write callable provided by the WSGI server.

1. Template changes in 1.0

If you use your own template set (particularly for hgweb), here are some relevant changes.

  • Before 1.0, Content-Type was set as a line in header.tmpl. It was changed in 1.0 to use a "mimetype" value from the map. In 1.1, the old behavior has been removed.
  • Annotate templates now get a full user instead of the short version. Use "author|user" to revert to the previous behavior.
  • Annotate lines now also have the "desc" variable, in order to show the commit message for that line's changeset.
  • Parent and child links (in changeset and diff pages, for example) can now show much more information about those changesets.
  • Branch name and branch head information is available in many more places.

ApiChanges (last edited 2018-11-02 13:59:39 by AntonShestakov)