|
|
|
|
|
|
|
|
* @return true if the specified object is stored in this repo or any of the |
|
|
* @return true if the specified object is stored in this repo or any of the |
|
|
* known shared repositories. |
|
|
* known shared repositories. |
|
|
*/ |
|
|
*/ |
|
|
public boolean hasObject(final AnyObjectId objectId) { |
|
|
|
|
|
return objectDatabase.hasObject(objectId); |
|
|
|
|
|
|
|
|
public boolean hasObject(AnyObjectId objectId) { |
|
|
|
|
|
return getObjectDatabase().hasObject(objectId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
* object, or null if the object does not exist. |
|
|
* object, or null if the object does not exist. |
|
|
* @throws IOException |
|
|
* @throws IOException |
|
|
*/ |
|
|
*/ |
|
|
public ObjectLoader openObject(final WindowCursor curs, final AnyObjectId id) |
|
|
|
|
|
|
|
|
public ObjectLoader openObject(WindowCursor curs, AnyObjectId id) |
|
|
throws IOException { |
|
|
throws IOException { |
|
|
return objectDatabase.openObject(curs, id); |
|
|
|
|
|
|
|
|
return getObjectDatabase().openObject(curs, id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
* to the base ref, as the symbolic ref could not be read. |
|
|
* to the base ref, as the symbolic ref could not be read. |
|
|
*/ |
|
|
*/ |
|
|
public RefUpdate updateRef(final String ref, final boolean detach) throws IOException { |
|
|
public RefUpdate updateRef(final String ref, final boolean detach) throws IOException { |
|
|
return refs.newUpdate(ref, detach); |
|
|
|
|
|
|
|
|
return getRefDatabase().newUpdate(ref, detach); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
public RefRename renameRef(final String fromRef, final String toRef) throws IOException { |
|
|
public RefRename renameRef(final String fromRef, final String toRef) throws IOException { |
|
|
return refs.newRename(fromRef, toRef); |
|
|
|
|
|
|
|
|
return getRefDatabase().newRename(fromRef, toRef); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
useCnt.incrementAndGet(); |
|
|
useCnt.incrementAndGet(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Close all resources used by this repository |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
/** Decrement the use count, and maybe close resources. */ |
|
|
public void close() { |
|
|
public void close() { |
|
|
if (useCnt.decrementAndGet() == 0) { |
|
|
if (useCnt.decrementAndGet() == 0) { |
|
|
objectDatabase.close(); |
|
|
|
|
|
refs.close(); |
|
|
|
|
|
|
|
|
doClose(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Invoked when the use count drops to zero during {@link #close()}. |
|
|
|
|
|
* <p> |
|
|
|
|
|
* The default implementation closes the object and ref databases. |
|
|
|
|
|
*/ |
|
|
|
|
|
protected void doClose() { |
|
|
|
|
|
getObjectDatabase().close(); |
|
|
|
|
|
getRefDatabase().close(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Add a single existing pack to the list of available pack files. |
|
|
* Add a single existing pack to the list of available pack files. |
|
|
* |
|
|
* |
|
|
|
|
|
|
|
|
* @throws IOException |
|
|
* @throws IOException |
|
|
*/ |
|
|
*/ |
|
|
public Ref getRef(final String name) throws IOException { |
|
|
public Ref getRef(final String name) throws IOException { |
|
|
return refs.getRef(name); |
|
|
|
|
|
|
|
|
return getRefDatabase().getRef(name); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public Map<String, Ref> getAllRefs() { |
|
|
public Map<String, Ref> getAllRefs() { |
|
|
try { |
|
|
try { |
|
|
return refs.getRefs(RefDatabase.ALL); |
|
|
|
|
|
|
|
|
return getRefDatabase().getRefs(RefDatabase.ALL); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
return new HashMap<String, Ref>(); |
|
|
return new HashMap<String, Ref>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public Map<String, Ref> getTags() { |
|
|
public Map<String, Ref> getTags() { |
|
|
try { |
|
|
try { |
|
|
return refs.getRefs(Constants.R_TAGS); |
|
|
|
|
|
|
|
|
return getRefDatabase().getRefs(Constants.R_TAGS); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
return new HashMap<String, Ref>(); |
|
|
return new HashMap<String, Ref>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public Ref peel(final Ref ref) { |
|
|
public Ref peel(final Ref ref) { |
|
|
try { |
|
|
try { |
|
|
return refs.peel(ref); |
|
|
|
|
|
|
|
|
return getRefDatabase().peel(ref); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
// Historical accident; if the reference cannot be peeled due |
|
|
// Historical accident; if the reference cannot be peeled due |
|
|
// to some sort of repository access problem we claim that the |
|
|
// to some sort of repository access problem we claim that the |