Mercurial > repo
changeset 4587:6df398684375
<oerjan> chmod +x url; mv url bin
author | HackBot |
---|---|
date | Sat, 19 Apr 2014 23:50:37 +0000 |
parents | dd7f566433be |
children | b873f9de779b |
files | bin/url url |
diffstat | 2 files changed, 7 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/url Sat Apr 19 23:50:25 2014 +0000 +++ b/bin/url Sat Apr 19 23:50:37 2014 +0000 @@ -1,7 +1,11 @@ #!/usr/bin/env python -import sys, urllib +import sys, re, urllib if len(sys.argv) <= 1: print "http://codu.org/projects/hackbot/fshg/" else: - print ("http://codu.org/projects/hackbot/fshg/index.cgi/file/tip/" + - urllib.quote(sys.argv[1])) + f = re.sub(r"^/hackenv/", "", sys.argv[1]) + 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))
--- a/url Sat Apr 19 23:50:25 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/usr/bin/env python -import sys, re, urllib -if len(sys.argv) <= 1: - print "http://codu.org/projects/hackbot/fshg/" -else: - f = re.sub(r"^/hackenv/", "", sys.argv[1]) - 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))