##// END OF EJS Templates
fix(LFS): fixed pull_changes method to support a new (sync_large_objects) flag, updated all parts that will use a new flag. Fixes: RCCE-8
ilin.s -
r5256:6b054b38 default
parent child Browse files
Show More
@@ -2227,7 +2227,7 b' def revoke_user_group_permission(request'
2227
2227
2228
2228
2229 @jsonrpc_method()
2229 @jsonrpc_method()
2230 def pull(request, apiuser, repoid, remote_uri=Optional(None)):
2230 def pull(request, apiuser, repoid, remote_uri=Optional(None), sync_large_objects=Optional(False)):
2231 """
2231 """
2232 Triggers a pull on the given repository from a remote location. You
2232 Triggers a pull on the given repository from a remote location. You
2233 can use this to keep remote repositories up-to-date.
2233 can use this to keep remote repositories up-to-date.
@@ -2244,6 +2244,8 b' def pull(request, apiuser, repoid, remot'
2244 :type repoid: str or int
2244 :type repoid: str or int
2245 :param remote_uri: Optional remote URI to pass in for pull
2245 :param remote_uri: Optional remote URI to pass in for pull
2246 :type remote_uri: str
2246 :type remote_uri: str
2247 :param sync_large_objects: Optional flag for pulling LFS objects.
2248 :type sync_large_objects: bool
2247
2249
2248 Example output:
2250 Example output:
2249
2251
@@ -2277,7 +2279,7 b' def pull(request, apiuser, repoid, remot'
2277
2279
2278 try:
2280 try:
2279 ScmModel().pull_changes(
2281 ScmModel().pull_changes(
2280 repo.repo_name, apiuser.username, remote_uri=remote_uri)
2282 repo.repo_name, apiuser.username, remote_uri=remote_uri, sync_large_objects=sync_large_objects)
2281 return {
2283 return {
2282 'msg': 'Pulled from url `{}` on repo `{}`'.format(
2284 'msg': 'Pulled from url `{}` on repo `{}`'.format(
2283 remote_uri_display, repo.repo_name),
2285 remote_uri_display, repo.repo_name),
@@ -52,7 +52,7 b' class RepoSettingsRemoteView(RepoAppView'
52
52
53 try:
53 try:
54 ScmModel().pull_changes(
54 ScmModel().pull_changes(
55 self.db_repo_name, self._rhodecode_user.username)
55 self.db_repo_name, self._rhodecode_user.username, sync_large_objects=True)
56 h.flash(_('Pulled from remote location'), category='success')
56 h.flash(_('Pulled from remote location'), category='success')
57 except Exception:
57 except Exception:
58 log.exception("Exception during pull from remote")
58 log.exception("Exception during pull from remote")
@@ -669,11 +669,11 b' class GitRepository(BaseRepository):'
669 self._remote.pull(url, refs=refs, update_after=update_after)
669 self._remote.pull(url, refs=refs, update_after=update_after)
670 self._remote.invalidate_vcs_cache()
670 self._remote.invalidate_vcs_cache()
671
671
672 def fetch(self, url, commit_ids=None):
672 def fetch(self, url, commit_ids=None, **kwargs):
673 """
673 """
674 Fetch all git objects from external location.
674 Fetch all git objects from external location.
675 """
675 """
676 self._remote.sync_fetch(url, refs=commit_ids)
676 self._remote.sync_fetch(url, refs=commit_ids, **kwargs)
677 self._remote.invalidate_vcs_cache()
677 self._remote.invalidate_vcs_cache()
678
678
679 def push(self, url):
679 def push(self, url):
@@ -577,7 +577,7 b' class MercurialRepository(BaseRepository'
577 self._remote.pull(url, commit_ids=commit_ids)
577 self._remote.pull(url, commit_ids=commit_ids)
578 self._remote.invalidate_vcs_cache()
578 self._remote.invalidate_vcs_cache()
579
579
580 def fetch(self, url, commit_ids=None):
580 def fetch(self, url, commit_ids=None, **kwargs):
581 """
581 """
582 Backward compatibility with GIT fetch==pull
582 Backward compatibility with GIT fetch==pull
583 """
583 """
@@ -387,7 +387,7 b' class ScmModel(BaseModel):'
387 self.sa.add(repo)
387 self.sa.add(repo)
388 return repo
388 return repo
389
389
390 def pull_changes(self, repo, username, remote_uri=None, validate_uri=True):
390 def pull_changes(self, repo, username, remote_uri=None, validate_uri=True, **kwargs):
391 dbrepo = self._get_repo(repo)
391 dbrepo = self._get_repo(repo)
392 remote_uri = remote_uri or dbrepo.clone_uri
392 remote_uri = remote_uri or dbrepo.clone_uri
393 if not remote_uri:
393 if not remote_uri:
@@ -409,7 +409,7 b' class ScmModel(BaseModel):'
409 repo_name = dbrepo.repo_name
409 repo_name = dbrepo.repo_name
410 try:
410 try:
411 # TODO: we need to make sure those operations call proper hooks !
411 # TODO: we need to make sure those operations call proper hooks !
412 repo.fetch(remote_uri)
412 repo.fetch(remote_uri, **kwargs)
413
413
414 self.mark_for_invalidation(repo_name)
414 self.mark_for_invalidation(repo_name)
415 except Exception:
415 except Exception:
General Comments 0
You need to be logged in to leave comments. Login now