Mercurial > repo
view bin/url @ 4601:30c35498e6b8
<fizzie> sed -i -e \'s/sys,/sys, os.path,/\' -e \'s/sys.argv\\[1\\]/f/\' -e \'5{p;s/.*/ f = os.path.abspath(sys.argv[1])/}\' bin/url
author | HackBot |
---|---|
date | Sun, 20 Apr 2014 08:05:05 +0000 |
parents | c61591186709 |
children | 7de7b5fe850f |
line wrap: on
line source
#!/usr/bin/env python import sys, os.path, re, urllib if len(sys.argv) <= 1: print "http://codu.org/projects/hackbot/fshg/" else: f = os.path.abspath(sys.argv[1]) f = re.sub(r"^/+hackenv/", "", f) if f.startswith("/"): sys.exit("File is outside hg repository.") else: print ("http://codu.org/projects/hackbot/fshg/index.cgi/file/tip/" + urllib.quote(f))