6 def get_repo(alias
, url
):
8 from mercurial
import hg
, ui
10 sys
.stderr
.write("Mercurial python libraries not installed!\n")
14 source
, revs
, checkout
= hg
.parseurl(ui
.expandpath(url
), [])
15 repo
= hg
.repository(ui
, source
)
23 def do_capabilities(repo
, args
):
27 sys
.stderr
.write("Capabilities are AWESUM.\n")
29 print # end capabilities
32 def do_list(repo
, args
):
36 from mercurial
.node
import hex
38 sys
.stderr
.write("? %s (%s)\n" % (ref
, hex(repo
.lookup(ref
))))
45 'capabilities': do_capabilities
,
52 sys
.stderr
.write("Missing url and stuff.\n")
57 if url
.startswith('hg+'):
59 elif url
.startswith('hg::'):
62 repo
= get_repo(alias
, url
)
64 sys
.stderr
.write("How can I help u todayz on %s?\n" % args
[1:])
65 line
= sys
.stdin
.readline()
68 cmdline
= line
.strip().split()
71 break # Blank line means we're about to quit
74 sys
.stderr
.write("Got command '%s' with args '%s'\n" % (cmd
, ' '.join(cmdline
)))
76 if cmd
not in COMMANDS
:
77 sys
.stderr
.write("Dunno how to handle that, SUCKAH\n")
84 line
= sys
.stdin
.readline()
87 if __name__
== '__main__':
88 sys
.exit(main(sys
.argv
))