예제 #1
0
 def delete_remote_ref(self, name):
     origin_ = __main__.get_repo_git_dir() + "/refs/remotes/origin/"
     splited_name = name.split('/')
     if len(splited_name) > 1:
         path = origin_ + name
         if os.path.exists(path):
             os.removedirs(path)
     else:
         path = origin_ + name
         if os.path.exists(path):
             os.remove(path)
예제 #2
0
 def delete_local_ref(self, name):
     path_prefix = __main__.get_repo_git_dir() + "/refs/heads/"
     last_slash_index = name.rfind('/')
     if last_slash_index != -1:
         try:
             os.remove(path_prefix + name)
             os.removedirs(path_prefix + name[0: last_slash_index])
         except OSError as e:
             print(e.message)
     else:
         try:
             os.remove(path_prefix + name)
         except OSError as e:
             print(e.message)
예제 #3
0
 def create_local_ref(self, name):
     path_prefix = __main__.get_repo_git_dir() + "/refs/heads/"
     self.create_dirs_and_file(name, path_prefix)
예제 #4
0
 def put_ref_in_head(self, ref_name):
     with open(__main__.get_repo_git_dir() + "/HEAD", 'w') as f:
         f.write("ref: refs/heads/%s" % ref_name)
예제 #5
0
 def create_remote_ref(self, name):
     path_prefix = __main__.get_repo_git_dir() + "/refs/remotes/origin/"
     self.create_dirs_and_file(name, path_prefix)