def herd(self): """Clone project or update latest from upstream""" self._print_status() if not os.path.isdir(os.path.join(self.full_path(), '.git')): git_clone_url_at_path(self.url, self.full_path(), self.ref, self.remote_name) else: ref_type = git_ref_type(self.ref) if ref_type is 'branch': git_create_remote(self.full_path(), self.remote_name, self.url) git_fetch(self.full_path()) git_checkout_ref(self.full_path(), self.ref, self.remote_name) branch = git_truncate_ref(self.ref) git_pull_remote_branch(self.full_path(), self.remote_name, branch) elif ref_type is 'tag' or ref_type is 'sha': git_create_remote(self.full_path(), self.remote_name, self.url) git_fetch(self.full_path()) git_checkout_ref(self.full_path(), self.ref, self.remote_name) else: print('Unknown ref ' + self.ref)
def herd(self, ref, depth): """Herd remote data from fork""" self._print_status() git_create_remote(self.path, self.remote, self.url) git_fetch_remote(self.path, self.remote, ref, depth)