Exemple #1
0
    def handle(self, options, global_options, *args):
        from config import GitBundlerConfig
        from server import GitBundlerServer
        config = GitBundlerConfig()

        while 1:
            run_flag = 0
            if options.bundle:
                server = GitBundlerServer()
                if server:
                    server.pushbundle(options.bundle, range=options.range)
                    run_flag = 1
            else:
                server = GitBundlerServer()
                if server:
                    path = os.getcwd()
                    server.pushdir(path, range=options.range)
                    run_flag = 1

            if run_flag == 0:
                return self.print_help(__prog_name__, self.name)
            else:
                if not options.loop:
                    return
                else:
                    time.sleep(
                        int(
                            config.get('server.loop.interval', verbose=False)
                            or 100))
Exemple #2
0
 def handle(self, options, global_options, *args):
     from config import GitBundlerConfig
     from server import GitBundlerServer
     config = GitBundlerConfig()
     
     while 1:
         run_flag = 0
         if options.bundle:
             server = GitBundlerServer()
             if server:
                 server.pushbundle(options.bundle, range=options.range)
                 run_flag = 1
         else:
             server = GitBundlerServer()
             if server:
                 path = os.getcwd()
                 server.pushdir(path, range=options.range)
                 run_flag = 1
         
         if run_flag == 0:
             return self.print_help(__prog_name__, self.name)
         else:
             if not options.loop:
                 return 
             else:
                 time.sleep(int(config.get('server.loop.interval', verbose=False) or 100))
Exemple #3
0
 def guess_bundle(self, name=None, path=None):
     config = GitBundlerConfig()
     repo, filename, options = (None, None, None)
     if name:
         repo, filename, options = config.get_serverbundle(name)
     if path:
         repo, filename, options = config.get_serverbundle_match(path)
         
     if repo and filename and options:
         self.repo = repo
         self.filename = filename
         self.options = options
         return True
     return False
Exemple #4
0
    def handle(self, options, global_options, *args):
        from config import GitBundlerConfig
        from server import GitBundlerClient
        config = GitBundlerConfig()

        if len(args) >= 1:
            client = GitBundlerClient()
            if client:
                for filename in args:
                    client.download(filename)
            return
        self.print_help(__prog_name__, self.name)
Exemple #5
0
    def handle(self, options, global_options, *args):
        from config import GitBundlerConfig
        from server import GitBundlerServer
        config = GitBundlerConfig()

        if len(args) >= 1:
            server = GitBundlerServer()
            if server:
                for filename in args:
                    server.upload(filename)
            return

        self.print_help(__prog_name__, self.name)
Exemple #6
0
    def handle(self, options, global_options, *args):
        from config import GitBundlerConfig
        from server import GitBundlerClient
        config = GitBundlerConfig()

        client = GitBundlerClient()
        if client:
            if options.bundle:
                return client.pullbundle(options.bundle,
                                         force_branch=options.force_branch)
            else:
                path = os.getcwd()
                return client.pulldir(path, force_branch=options.force_branch)

        self.print_help(__prog_name__, self.name)
Exemple #7
0
    def handle(self, options, global_options, *args):
        from config import GitBundlerConfig
        from server import GitBundlerServer
        config = GitBundlerConfig()

        server = GitBundlerServer()
        path = path = os.getcwd()

        if server and server.guess_bundle(name=options.bundle, path=path):
            if len(args) == 2:
                server.lpush(args[0], branch=args[1])

            if len(args) == 1:
                server.lpush(args[0])

            if len(args) == 0:
                server.lpush('local')
Exemple #8
0
    def handle(self, options, global_options, *args):
        from config import GitBundlerConfig
        config = GitBundlerConfig()

        if options.list:
            return config.list_all()
        elif options.add:
            if len(args) == 2:
                return config.add(args[0], args[1])
        elif options.get:
            if len(args) == 1:
                return config.get(args[0])
        elif options.unset:
            if len(args) == 1:
                return config.unset(args[0])
        elif options.remove_section and len(args) == 1:
            return config.remove_section(args[0])
        elif options.configFile:
            return config.import_file(options.configFile)
        elif options.exportFile:
            return config.export_file(options.exportFile)

        self.print_help(__prog_name__, self.name)
Exemple #9
0
 def handle(self, options, global_options, *args):
     from config import GitBundlerConfig
     config = GitBundlerConfig()
     
     if options.list:
         return config.list_all()
     elif options.add:
         if len(args) == 2:
             return config.add(args[0], args[1])
     elif options.get:
         if len(args) == 1:
             return config.get(args[0])
     elif options.unset:
         if len(args) == 1:
             return config.unset(args[0])
     elif options.remove_section and len(args) == 1:
         return config.remove_section(args[0])
     elif options.configFile:
         return config.import_file(options.configFile)
     elif options.exportFile:
         return config.export_file(options.exportFile)
         
     self.print_help(__prog_name__, self.name)
Exemple #10
0
    def handle(self, options, global_options, *args):
        from config import GitBundlerConfig
        from server import GitBundlerClient
        config = GitBundlerConfig()

        if len(args) >= 1:
            client = GitBundlerClient()
            if client:
                ofile = None
                commit_id = args[0]
                if options.output_filename:
                    ofile = options.output_filename

                if options.bundle:
                    return client.archive_bundle(options.bundle, commit_id,
                                                 ofile)
                else:
                    path = os.getcwd()
                    return client.archive_dir(path, commit_id, ofile)

            return
        self.print_help(__prog_name__, self.name)
Exemple #11
0
 def __init__(self):
     config = GitBundlerConfig()
     self.url = config.get('server.upload.url', verbose=False)
     self.user = config.get('server.upload.user', verbose=False)
     self.password = config.get('server.upload.password', verbose=False)
Exemple #12
0
 def archive_dir(self, path, commit, output):
     config = GitBundlerConfig()
     repo, filename = config.get_clientbundle_match(path)
 
     if repo and filename:
         self.archive(repo, filename, commit, output)
Exemple #13
0
 def archive_bundle(self, bundlename, commit, output):
     config = GitBundlerConfig()
     repo, filename = config.get_clientbundle(bundlename)
     if repo and filename:
         self.archive(repo, filename, commit, output)
Exemple #14
0
    def pulldir(self, path, force_branch=None):
        config = GitBundlerConfig()
        repo, filename = config.get_clientbundle_match(path)

        if repo and filename:
            self.pull(repo, filename, force_branch)
Exemple #15
0
 def pullbundle(self, bundlename, force_branch=None):
     config = GitBundlerConfig()
     repo, filename = config.get_clientbundle(bundlename)
     if repo and filename:
         self.pull(repo, filename, force_branch)