• Home
  • Raw
  • Download

Lines Matching +full:base +full:- +full:repo

55     This class represents a git repo.
57 It is used to pull down a local copy of a git repo, check if the local
58 repo is up-to-date, if not update. It delegates the install to
66 @param repodir: destination repo directory.
67 @param giturl: main repo git url.
68 @param weburl: a web url for the main repo.
69 @param abs_work_tree: work tree of the git repo. In the
72 In such repos the -git-dir option should point to
73 the .git directory and -work-tree should point to
77 (.git) in the same directory. This class assumes non-bare
92 # Find git base command. If not found, this will throw an exception
107 raise ValueError('Unsupported operation -- this object was not'
117 # base git command , pointing to gitpath git dir
118 gitcmdbase = '%s --git-dir=%s' % (self.git_base_cmd,
121 gitcmdbase += ' --work-tree=%s' % self.work_tree
171 Clones a repo using giturl and repodir.
173 Since we're cloning the main repo we don't have a work tree yet,
181 @raises GitCloneError: if cloning the main repo fails.
183 logging.info('Cloning git repo %s', self.giturl)
186 cmd += '-b %s' % remote_branch
188 cmd += '--depth 1'
210 logging.info('Updating git repo %s', self.giturl)
213 cmd += '--rebase '
219 e_msg = 'Failed to pull git repo data'
225 Commit changes to repo with the supplied commit msg.
229 rv = self.gitcmd('commit -a -m \'%s\'' % msg)
281 Reset repo to the given branch or git sha.
287 self.gitcmd('reset --hard %s' % branch_or_sha,
294 Reset repo to HEAD@{0} by running git reset --hard HEAD.
300 logging.info('Resetting head on repo %s', self.repodir)
301 rv = self.gitcmd('reset --hard HEAD')
314 logging.info('fetching from repo %s', self.giturl)
315 rv = self.gitcmd('fetch --all')
324 Does all it can to ensure that the repo is at remote_branch.
328 everything so that local repo reflects the upstream branch requested.
336 # Re-stat all files before comparing index. This is needed for
337 # diff-index to work properly in cases when the stat info on files is
340 rv = self.gitcmd('update-index --refresh -q',
344 'diff-index --quiet HEAD --',
353 # Don't trust the existing repo setup at all (so don't trust the current
358 self.gitcmd('checkout -f',
361 self.gitcmd('clean -qxdf',
372 this method will leave an up-to-date version of git repo at
382 # exiting repo, check if we're up-to-date
385 logging.info('repo up-to-date')
397 cmd = 'log --pretty=format:"%H" -1'
410 cmd2 = 'log --pretty=format:"%H" -1 ' + origin_name_cmd.stdout.strip()
424 # local is out-of-date, pull
433 Return whether the git repo was already initialized.
436 repo is empty. Assumes non-bare reposotories like the rest of this file.
438 @return: True if the repo is initialized.
440 cmd = 'count-objects'
450 Get the commit hash of the latest commit in the repo.
458 cmd = 'rev-list -n 1 --all'
469 eg: we clone an empty main repo, then don't pull
472 @return True if the repo has no commits.
486 cmd = 'rev-parse --verify HEAD'
510 cmd = 'checkout -b %s %s' % (local, remote)
525 @param all: List both remote-tracking branches and local branches (True)
527 @param remote_tracking: Lists the remote-tracking branches.
532 cmd = 'branch --no-color'
534 cmd = " ".join([cmd, "-a"])
536 cmd = " ".join([cmd, "-r"])
552 Return the current status of the git repo.
554 @param short: Whether to give the output in the short-format.
559 cmd += ' -s'