Skip to content

Commit

Permalink
adjusted _push_to_remote to work with both do_push and do_import methods
Browse files Browse the repository at this point in the history
  • Loading branch information
herlo committed Dec 2, 2011
1 parent 53da594 commit 621556a
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions skein/pyskein.py
Expand Up @@ -526,16 +526,19 @@ def _commit(self, message=None):
# commit files added to the index
index.commit(message)

def _push_to_remote(self, message=None):
def _push_to_remote(self, name, message=None):
"""Push any/all changes to remote repository
:param str name: repository name (same as package)
"""

self.logger.info("== Pushing git repo ==")

self._init_git_repo("%s/%s" % (proj_dir, self.cfgs['skein']['git_dir']), name)
proj_dir = "%s/%s" % (self.cfgs['skein']['proj_dir'], name)

if self.repo.is_dirty() or self.repo.untracked_files:
self.logger.debug(" repo %s is a dirty girl!" % self.repo)
self.logger.debug(" repo '%s' has been a DIRTY girl!" % self.repo)
self._commit(message)

try:
Expand Down Expand Up @@ -786,6 +789,13 @@ def grant_request(self, args):
self.gitremote.close_repo_request(args.id, name)

def do_extract_pkg(self, args):
"""Extract a package. Copies the spec, sources and patches appropriately
in preparation for a commit and push (skein push) and upload to the lookaside
cache (skein upload)
:param str args.path: path to source rpm
:param str args.message (optional): commit message
"""

for p in args.path:
srpms = self._get_srpm_list(p)
Expand Down Expand Up @@ -813,18 +823,25 @@ def do_extract_pkg(self, args):
self._do_makefile(git_dest)

def do_push(self, args):
"""Push to remote git repository
name = args.name
proj_dir = "%s/%s" % (self.cfgs['skein']['proj_dir'], name)
self._init_git_repo("%s/%s" % (proj_dir, self.cfgs['skein']['git_dir']), name)
:param str args.name: repository name
:param str args.message (optional): commit message
"""

name = args.name
message = None
if args.message:
message = args.message

self._push_to_remote(message)
self._push_to_remote(name, message)

def do_upload(self, args):
"""Upload source(s) to lookaside cache
:param str args.name: repository name
"""

name = args.name
self._upload_source(name)

Expand Down

0 comments on commit 621556a

Please sign in to comment.