Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgChangeset.java @ 196:e2115da4cf6a
Pool objects to avoid memory polution with duplicates
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 18 Apr 2011 18:04:24 +0200 |
parents | c9b305df0b89 |
children | 644ee58c9f16 |
comparison
equal
deleted
inserted
replaced
195:c9b305df0b89 | 196:e2115da4cf6a |
---|---|
62 } | 62 } |
63 | 63 |
64 /*package-local*/ void init(int localRevNumber, Nodeid nid, RawChangeset rawChangeset) { | 64 /*package-local*/ void init(int localRevNumber, Nodeid nid, RawChangeset rawChangeset) { |
65 revNumber = localRevNumber; | 65 revNumber = localRevNumber; |
66 nodeid = nid; | 66 nodeid = nid; |
67 changeset = rawChangeset; | 67 changeset = rawChangeset.clone(); |
68 modifiedFiles = addedFiles = null; | 68 modifiedFiles = addedFiles = null; |
69 deletedFiles = null; | 69 deletedFiles = null; |
70 parent1 = parent2 = null; | 70 parent1 = parent2 = null; |
71 // keep references to parentHelper, statusHelper and pathHelper | 71 // keep references to parentHelper, statusHelper and pathHelper |
72 } | 72 } |
167 | 167 |
168 @Override | 168 @Override |
169 public HgChangeset clone() { | 169 public HgChangeset clone() { |
170 try { | 170 try { |
171 HgChangeset copy = (HgChangeset) super.clone(); | 171 HgChangeset copy = (HgChangeset) super.clone(); |
172 copy.changeset = changeset.clone(); | 172 // copy.changeset references this.changeset, doesn't need own copy |
173 return copy; | 173 return copy; |
174 } catch (CloneNotSupportedException ex) { | 174 } catch (CloneNotSupportedException ex) { |
175 throw new InternalError(ex.toString()); | 175 throw new InternalError(ex.toString()); |
176 } | 176 } |
177 } | 177 } |