git_brch_no_tx.patch

Etienne Massip, 2011-10-28 12:30

Download (1.49 KB)

View differences:

C:/Documents and Settings/e1263830/Desktop/patched_git.rb Fri Oct 28 12:26:31 2011
142 142
    end
143 143
    scm_brs.each do |br1|
144 144
      br = br1.to_s
145
      rev = nil
145 146
      from_scmid = nil
146 147
      from_scmid = h["branches"][br]["last_scmid"] if h["branches"][br]
147 148
      h["branches"][br] ||= {}
148 149
      scm.revisions('', from_scmid, br, {:reverse => true}) do |rev|
149
        db_rev = find_changeset_by_name(rev.revision)
150
        transaction do
151
          if db_rev.nil?
152
            save_revision(rev)
153
          end
154
          h["branches"][br]["last_scmid"] = rev.scmid
155
          merge_extra_info(h)
156
          self.save
157
        end
150
        find_changeset_by_name(rev.revision) || save_revision(rev)
151
      end
152
      unless rev.nil?
153
        h["branches"][br]["last_scmid"] = rev.scmid
154
        merge_extra_info(h)
155
        self.save
158 156
      end
159 157
    end
160 158
  end
......
168 166
              :committed_on => rev.time,
169 167
              :comments     => rev.message
170 168
              )
171
    if changeset.save
172
      rev.paths.each do |file|
173
        Change.create(
169
    changeset.changes =
170
      rev.paths.collect do |file|
171
        Change.new(
174 172
                  :changeset => changeset,
175 173
                  :action    => file[:action],
176 174
                  :path      => file[:path])
177 175
      end
178 176
    end
179
    changeset
177
    changeset.save!
180 178
  end
181 179
  private :save_revision
182 180