Created
May 9, 2012 07:50
-
-
Save fudanchii/2642781 to your computer and use it in GitHub Desktop.
fabric file to manage mercurial repository in remote host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import * | |
from fabric import contrib | |
# Put your server address here | |
env.host_string = "192.168.0.133:2221" | |
env.user = "hg" | |
# Put your username here | |
user="adie" | |
def create(name): | |
if contrib.files.exists("%s/%s" % (user, name)): | |
print("Path given already exists.") | |
return | |
run("mkdir -p %s/%s" % (user, name)) | |
with cd("%s/%s" % (user, name)): | |
run("hg init") | |
print("Mercurial repository created at ssh://%s@%s/%s/%s" % | |
(env.user, env.host_string, user, name)) | |
def delete(name): | |
if contrib.files.exists("%s/%s" % (user, name)): | |
run("rm -r %s/%s" % (user, name)) | |
print("Repo %s/%s deleted." % (user, name)) | |
def ls(): | |
run("ls %s" % user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment