示例#1
0
 def annex_init(self, if_ssh):
     self.init(if_ssh)
     if (if_ssh == 1):
         username, host, path = split_data(self.path)
         password = []
         connection = Ssh(host, username, password)
         command = "cd " + path + " && git annex init " + path
         cmdAnswer = connection.git_Command(command)
         lines = cmdAnswer.split(" ")
         for line in lines:
             if ("ok" in line):
                 print('Annex repository initialized')
             else:
                 print(line + " ")
     else:
         p = Popen(['git', 'annex', 'init', self.path],
                   cwd=self.path,
                   stdin=PIPE,
                   stdout=PIPE,
                   stderr=PIPE,
                   bufsize=1)
         for line in p.stdout:
             line = line.decode('UTF-8')[:-1]
             if "ok" in line:
                 if self.logs == 1:
                     print('Annex repository initialized')
                     #return 0
             else:
                 print(line)
示例#2
0
 def init(self, if_ssh):
     if (if_ssh == 1):
         username, host, path = split_data(self.path)
         password = []
         connection = Ssh(host, username, password)
         command = "cd " + path + " && git init " + path
         cmdAnswer = connection.git_Command(command)
     else:
         cmdAnswer = check_output(['git', 'init',
                                   self.path]).decode('UTF-8')
         print(cmdAnswer)
     if cmdAnswer[:32] == 'Initialized empty Git repository':
         if self.logs == 1: print('Repository initialized')
         #return 0
     elif cmdAnswer[:37] == 'Reinitialized existing Git repository':
         if self.logs == 1: print('Repository reinitialized')
         #return 0
     else:
         if self.logs == 1: print('Initialization failed')