Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.LockFailedException


   */
  public static DirCache lock(final File indexLocation, final FS fs)
      throws CorruptObjectException, IOException {
    final DirCache c = new DirCache(indexLocation, fs);
    if (!c.lock())
      throw new LockFailedException(indexLocation);

    try {
      c.read();
    } catch (IOException e) {
      c.unlock();
View Full Code Here


   */
  public void save() throws IOException {
    final byte[] out = Constants.encode(toText());
    final LockFile lf = new LockFile(getFile(), fs);
    if (!lf.lock())
      throw new LockFailedException(getFile());
    try {
      lf.setNeedSnapshot(true);
      lf.write(out);
      if (!lf.commit())
        throw new IOException(MessageFormat.format(JGitText.get().cannotCommitWriteTo, getFile()));
View Full Code Here

      // If we have a reason to create a keep file for this pack, do
      // so, or fail fast and don't put the pack in place.
      //
      try {
        if (!keep.lock(lockMessage))
          throw new LockFailedException(finalPack,
              MessageFormat.format(
                  JGitText.get().cannotLockPackIn, finalPack));
      } catch (IOException e) {
        cleanupTemporaryFiles();
        throw e;
View Full Code Here

    final PackedRefList packed = getPackedRefs();
    if (packed.contains(name)) {
      LockFile lck = new LockFile(packedRefsFile,
          update.getRepository().getFS());
      if (!lck.lock())
        throw new LockFailedException(packedRefsFile);
      try {
        PackedRefList cur = readPackedRefs();
        int idx = cur.find(name);
        if (0 <= idx)
          commitPackedRefs(lck, cur.remove(idx), packed);
View Full Code Here

      out = Constants.encode(text);
    }

    final LockFile lf = new LockFile(getFile(), fs);
    if (!lf.lock())
      throw new LockFailedException(getFile());
    try {
      lf.setNeedSnapshot(true);
      lf.write(out);
      if (!lf.commit())
        throw new IOException(MessageFormat.format(JGitText.get().cannotCommitWriteTo, getFile()));
View Full Code Here

   */
  public static DirCache lock(final File indexLocation, final FS fs)
      throws CorruptObjectException, IOException {
    final DirCache c = new DirCache(indexLocation, fs);
    if (!c.lock())
      throw new LockFailedException(indexLocation);

    try {
      c.read();
    } catch (IOException e) {
      c.unlock();
View Full Code Here

      // If we have a reason to create a keep file for this pack, do
      // so, or fail fast and don't put the pack in place.
      //
      try {
        if (!keep.lock(lockMessage))
          throw new LockFailedException(finalPack,
              MessageFormat.format(
                  JGitText.get().cannotLockPackIn, finalPack));
      } catch (IOException e) {
        cleanupTemporaryFiles();
        throw e;
View Full Code Here

    final PackedRefList packed = getPackedRefs();
    if (packed.contains(name)) {
      LockFile lck = new LockFile(packedRefsFile,
          update.getRepository().getFS());
      if (!lck.lock())
        throw new LockFailedException(packedRefsFile);
      try {
        PackedRefList cur = readPackedRefs();
        int idx = cur.find(name);
        if (0 <= idx)
          commitPackedRefs(lck, cur.remove(idx), packed);
View Full Code Here

      out = Constants.encode(text);
    }

    final LockFile lf = new LockFile(getFile(), fs);
    if (!lf.lock())
      throw new LockFailedException(getFile());
    try {
      lf.setNeedSnapshot(true);
      lf.write(out);
      if (!lf.commit())
        throw new IOException(MessageFormat.format(JGitText.get().cannotCommitWriteTo, getFile()));
View Full Code Here

    String stashLockRef = ReflogWriter.refLockFor(R_STASH);
    File stashLockFile = writer.logFor(stashLockRef);
    File stashFile = writer.logFor(R_STASH);
    if (stashLockFile.exists())
      throw new JGitInternalException(JGitText.get().stashDropFailed,
          new LockFailedException(stashFile));

    entries.remove(stashRefEntry);
    ObjectId entryId = ObjectId.zeroId();
    try {
      for (int i = entries.size() - 1; i >= 0; i--) {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.LockFailedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.