Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 620:272ecffccc8a
Do not cache branch value of working copy as it's not possible to refresh it after commit now
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Sat, 18 May 2013 21:55:31 +0200 |
| parents | f41dd9a3b8af |
| children | 99ad1e3a4e4d |
comparison
equal
deleted
inserted
replaced
| 619:868b2ffdcd5c | 620:272ecffccc8a |
|---|---|
| 111 | 111 |
| 112 private HgRepositoryLock wdLock, storeLock; | 112 private HgRepositoryLock wdLock, storeLock; |
| 113 | 113 |
| 114 private final org.tmatesoft.hg.internal.Internals impl; | 114 private final org.tmatesoft.hg.internal.Internals impl; |
| 115 | 115 |
| 116 /* | |
| 117 * TODO [post-1.0] move to a better place, e.g. WorkingCopy container that tracks both dirstate and branches | |
| 118 * (and, perhaps, undo, lastcommit and other similar information), and is change listener so that we don't need to | |
| 119 * worry about this cached value become stale | |
| 120 */ | |
| 121 private String wcBranch; | |
| 122 | |
| 123 | |
| 124 HgRepository(String repositoryPath) { | 116 HgRepository(String repositoryPath) { |
| 125 workingDir = null; | 117 workingDir = null; |
| 126 repoLocation = repositoryPath; | 118 repoLocation = repositoryPath; |
| 127 normalizePath = null; | 119 normalizePath = null; |
| 128 sessionContext = null; | 120 sessionContext = null; |
| 272 /** | 264 /** |
| 273 * @return name of the branch associated with working directory, never <code>null</code>. | 265 * @return name of the branch associated with working directory, never <code>null</code>. |
| 274 * @throws HgInvalidControlFileException if attempt to read branch name failed. | 266 * @throws HgInvalidControlFileException if attempt to read branch name failed. |
| 275 */ | 267 */ |
| 276 public String getWorkingCopyBranchName() throws HgInvalidControlFileException { | 268 public String getWorkingCopyBranchName() throws HgInvalidControlFileException { |
| 277 if (wcBranch == null) { | 269 /* |
| 278 wcBranch = DirstateReader.readBranch(impl); | 270 * TODO [post-1.1] 1) cache value (now if cached, is not updated after commit) |
| 279 } | 271 * 2) move to a better place, e.g. WorkingCopy container that tracks both dirstate and branches |
| 272 * (and, perhaps, undo, lastcommit and other similar information), and is change listener so that we don't need to | |
| 273 * worry about this cached value become stale | |
| 274 */ | |
| 275 String wcBranch = DirstateReader.readBranch(impl); | |
| 280 return wcBranch; | 276 return wcBranch; |
| 281 } | 277 } |
| 282 | 278 |
| 283 /** | 279 /** |
| 284 * @return location where user files (shall) reside | 280 * @return location where user files (shall) reside |
