Mercurial > hg4j
comparison src/org/tmatesoft/hg/repo/HgBundle.java @ 186:44a34baabea0
Clone refactored into a command. HgBundle needs means to control its lifecycle, to be deleted when no longer needed
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Thu, 14 Apr 2011 00:47:04 +0200 |
| parents | f26ffe04ced0 |
| children | 9fb50c04f03c |
comparison
equal
deleted
inserted
replaced
| 185:c6fa4dbfc458 | 186:44a34baabea0 |
|---|---|
| 71 } else { | 71 } else { |
| 72 da.reset(); | 72 da.reset(); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 return da; | 75 return da; |
| 76 } | |
| 77 | |
| 78 private int uses = 0; | |
| 79 public HgBundle link() { | |
| 80 uses++; | |
| 81 return this; | |
| 82 } | |
| 83 public void unlink() { | |
| 84 uses--; | |
| 85 if (uses == 0 && bundleFile != null) { | |
| 86 bundleFile.deleteOnExit(); | |
| 87 } | |
| 88 } | |
| 89 public boolean inUse() { | |
| 90 return uses > 0; | |
| 76 } | 91 } |
| 77 | 92 |
| 78 /** | 93 /** |
| 79 * Get changes recorded in the bundle that are missing from the supplied repository. | 94 * Get changes recorded in the bundle that are missing from the supplied repository. |
| 80 * @param hgRepo repository that shall possess base revision for this bundle | 95 * @param hgRepo repository that shall possess base revision for this bundle |
