Project

General

Profile

Defect #3724 » mercurial_scmid_authoritative.patch

Make scmid the authoritative revision, since revisions are ambiguous to a DVCS - Peter Fern, 2009-12-15 14:44

View differences:

lib/redmine/scm/adapters/mercurial_adapter.rb
107 107
          revisions = Revisions.new
108 108
          cmd = "#{HG_BIN} --debug --encoding utf8 -R #{target('')} log -C --style #{shell_quote self.class.template_path}"
109 109
          if identifier_from && identifier_to
110
            cmd << " -r #{identifier_from.to_i}:#{identifier_to.to_i}"
110
            cmd << " -r #{identifier_from}:#{identifier_to}"
111 111
          elsif identifier_from
112
            cmd << " -r #{identifier_from.to_i}:"
112
            cmd << " -r #{identifier_from}:"
113 113
          end
114 114
          cmd << " --limit #{options[:limit].to_i}" if options[:limit]
115 115
          cmd << " #{path}" if path
......
134 134
                end
135 135
                paths.sort! { |x,y| x[:path] <=> y[:path] }
136 136
                
137
                revisions << Revision.new({:identifier => logentry.attributes['revision'],
137
                revisions << Revision.new({:identifier => logentry.attributes['node'],
138 138
                                            :scmid => logentry.attributes['node'],
139 139
                                            :author => (logentry.elements['author'] ? logentry.elements['author'].text : ""),
140 140
                                            :time => Time.parse(logentry.elements['date'].text).localtime,
......
152 152
        
153 153
        def diff(path, identifier_from, identifier_to=nil)
154 154
          path ||= ''
155
          cmd = "#{HG_BIN} -R #{target('')} diff --nodates"
155 156
          if identifier_to
156
            identifier_to = identifier_to.to_i 
157
            cmd << " -r #{identifier_to} -r #{identifier_from}"
157 158
          else
158
            identifier_to = identifier_from.to_i - 1
159
            cmd << " -r #{identifier_from}"
159 160
          end
160
          cmd = "#{HG_BIN} -R #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates"
161 161
          cmd << " -I #{target(path)}" unless path.empty?
162 162
          diff = []
163 163
          shellout(cmd) do |io|
......
187 187
          cmd = "#{HG_BIN} -R #{target('')}"
188 188
          cmd << " annotate -n -u"
189 189
          cmd << " -r " + (identifier ? identifier.to_s : "tip")
190
          cmd << " -r #{identifier.to_i}" if identifier
190
          cmd << " -r #{identifier}" if identifier
191 191
          cmd << " #{target(path)}"
192 192
          blame = Annotate.new
193 193
          shellout(cmd) do |io|
194 194
            io.each_line do |line|
195 195
              next unless line =~ %r{^([^:]+)\s(\d+):(.*)$}
196
              blame.add_line($3.rstrip, Revision.new(:identifier => $2.to_i, :author => $1.strip))
196
              blame.add_line($3.rstrip, Revision.new(:identifier => $2, :author => $1.strip))
197 197
            end
198 198
          end
199 199
          return nil if $? && $?.exitstatus != 0
(1-1/12)