hgweb.cgi
author Sean Farley <sean@farley.io>
Tue, 21 Jun 2016 14:58:49 -0700
changeset 29470 2ff243c415b4
parent 26421 4b0fc75f9403
child 43691 47ef023d0165
permissions -rwxr-xr-x
histedit: move autoverb rule to the commit it matches Inspired by how 'git rebase -i' works, we move the autoverb to the commit line summary that it matches. We do this by iterating over all rules and inserting each non-autoverb line into a key in an ordered dictionary. If we find an autoverb line later, we then search for the matching key and append it to the list (which is the value of each key in the dictionary). If we can't find a previous line to move to, then we leave the rule in the same spot. Tests have been updated but the diff looks a little messy because we need to change one of the summary lines so that it will actually move to a new spot. On top of that, we added -q flags to future some of the output and needed to change the file it modified so that it wouldn't cause a conflict.

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also https://mercurial-scm.org/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/path/to/repo/or/config"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)