def clone(output_buffer, optdict, url=None, project_dir=None): if not url: raise RugError('url must be specified') if optdict.has_key('-c'): repo_config = dict(map(lambda x: x.split('='), optdict['-c'].split(','))) else: repo_config = None Project.clone( url=url, project_dir=project_dir, source=optdict.get('-o'), revset=optdict.get('-b'), bare=optdict.has_key('--bare'), repo_config=repo_config, output_buffer=output_buffer )
class Sync(): def __init__(self): self.parser = OptionParser() self.parser.add_option("-b", "--branch", dest="branch", help="with checkout branch") self.parser.add_option("-C", "--repo-dir", dest="repodir", help="repo directory") self.parser.add_option("-R", "--recursive", dest="recursive", help="sync project and subproject recursively") self.parser.set_usage("mgit sync") def print_usage(self): self.parser.print_usage() def run(self, args): self.options,args = self.parser.parse_args(args) cwd = os.getcwd() if self.options.repodir != None: os.chdir("/".join([cwd, self.options.repodir])) self.project = Project() self.project.clone()
def clone(output_buffer, optdict, url=None, project_dir=None): if not url: raise RugError('url must be specified') Project.clone(url=url, project_dir=project_dir, source=optdict.get('-o'), revset=optdict.get('-b'), bare=optdict.has_key('--bare'), output_buffer=output_buffer)