implement local cache for mercurial remote repositories
git-svn-id: http://redmine.rubyforge.org/svn/branches/nbc@1908 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
fdbe52a2f7
commit
7e46d9b35b
2 files changed
+23
No files matched your search
@@ -21,6 +21,15 @@ class Repository::Mercurial < Repository
|
||||
attr_protected :root_url
|
||||
validates_presence_of :url
|
||||
|
||||
def init_cache
|
||||
return unless dir = repositories_cache_directory
|
||||
# we need to use a cache only if repository isn't local and dir exists
|
||||
if url[/^(|https?|ssh):\/\//]
|
||||
update_attribute(:cache_path, dir + project.identifier)
|
||||
update_attribute(:cache, true)
|
||||
end
|
||||
end
|
||||
|
||||
def scm_adapter
|
||||
Redmine::Scm::Adapters::MercurialAdapter
|
||||
end
|
||||
@@ -53,6 +62,8 @@ class Repository::Mercurial < Repository
|
||||
end
|
||||
|
||||
def fetch_changesets
|
||||
create_or_sync_cache if cache
|
||||
|
||||
scm_info = scm.info
|
||||
if scm_info
|
||||
# latest revision found in database
|
||||
|
||||
Reference in new issue
Block a user