comparison lib/redmine/scm/adapters/mercurial_adapter.rb @ 36:de76cd3e8c8e cc-branches

* Probably abortive experiments in extracting the branch from Hg
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 20 Oct 2010 10:07:29 +0100
parents e297bf495063
children
comparison
equal deleted inserted replaced
29:192d132064a5 36:de76cd3e8c8e
154 {:action => e.attributes['action'], :path => with_leading_slash(e.text), 154 {:action => e.attributes['action'], :path => with_leading_slash(e.text),
155 :from_path => (cpmap.member?(e.text) ? with_leading_slash(cpmap[e.text]) : nil), 155 :from_path => (cpmap.member?(e.text) ? with_leading_slash(cpmap[e.text]) : nil),
156 :from_revision => (cpmap.member?(e.text) ? le.attributes['revision'] : nil)} 156 :from_revision => (cpmap.member?(e.text) ? le.attributes['revision'] : nil)}
157 end.sort { |a, b| a[:path] <=> b[:path] } 157 end.sort { |a, b| a[:path] <=> b[:path] }
158 158
159 branch = le.elements['branch'].text;
160 logger.debug("Branch is #{branch}");
161
159 yield Revision.new(:identifier => le.attributes['revision'], 162 yield Revision.new(:identifier => le.attributes['revision'],
160 :revision => le.attributes['revision'], 163 :revision => le.attributes['revision'],
161 :scmid => le.attributes['node'], 164 :scmid => le.attributes['node'],
162 :author => (le.elements['author'].text rescue ''), 165 :author => (le.elements['author'].text rescue ''),
163 :time => Time.parse(le.elements['date'].text).localtime, 166 :time => Time.parse(le.elements['date'].text).localtime,
164 :message => le.elements['msg'].text, 167 :message => le.elements['msg'].text,
168 :branch => le.elements['branch'].text,
165 :paths => paths) 169 :paths => paths)
166 end 170 end
167 self 171 self
168 end 172 end
169 173
170 # Returns list of nodes in the specified branch 174 # Returns list of nodes in the specified branch
171 def nodes_in_branch(branch, path=nil, identifier_from=nil, identifier_to=nil, options={}) 175 def nodes_in_branch(branch, path=nil, identifier_from=nil, identifier_to=nil, options={})
176 logger.debug("nodes_in_branch: Branch is #{branch}");
172 hg_args = ['log', '--template', '{node|short}\n', '-b', branch] 177 hg_args = ['log', '--template', '{node|short}\n', '-b', branch]
173 hg_args << '-r' << "#{hgrev(identifier_from)}:#{hgrev(identifier_to)}" 178 hg_args << '-r' << "#{hgrev(identifier_from)}:#{hgrev(identifier_to)}"
174 hg_args << '--limit' << options[:limit] if options[:limit] 179 hg_args << '--limit' << options[:limit] if options[:limit]
175 hg_args << without_leading_slash(path) unless path.blank? 180 hg_args << without_leading_slash(path) unless path.blank?
176 hg(*hg_args) { |io| io.readlines.map { |e| e.chomp } } 181 hg(*hg_args) { |io| io.readlines.map { |e| e.chomp } }