Browse Source

Merge changes I9f1842c2,Ie139133b

* changes:
  Throw invalid ref exception instead of invalid remote exception
  Use constant for logs directory
stable-1.3
Shawn Pearce 13 years ago committed by Code Review
parent
commit
32263d310c
  1. 6
      org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java
  2. 8
      org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java
  3. 3
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ReflogReader.java

6
org.eclipse.jgit/src/org/eclipse/jgit/api/ReflogCommand.java

@ -47,7 +47,7 @@ import java.text.MessageFormat;
import java.util.Collection; import java.util.Collection;
import org.eclipse.jgit.JGitText; import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.ReflogEntry; import org.eclipse.jgit.storage.file.ReflogEntry;
@ -91,8 +91,8 @@ public class ReflogCommand extends GitCommand<Collection<ReflogEntry>> {
ReflogReader reader = new ReflogReader(repo, ref); ReflogReader reader = new ReflogReader(repo, ref);
return reader.getReverseEntries(); return reader.getReverseEntries();
} catch (IOException e) { } catch (IOException e) {
throw new InvalidRemoteException(MessageFormat.format( throw new InvalidRefNameException(MessageFormat.format(
JGitText.get().cannotRead, ref)); JGitText.get().cannotRead, ref), e);
} }
} }

8
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/InvalidRefNameException.java

@ -49,4 +49,12 @@ public class InvalidRefNameException extends GitAPIException {
public InvalidRefNameException(String msg) { public InvalidRefNameException(String msg) {
super(msg); super(msg);
} }
/**
* @param msg
* @param cause
*/
public InvalidRefNameException(String msg, Throwable cause) {
super(msg, cause);
}
} }

3
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ReflogReader.java

@ -51,6 +51,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.util.IO; import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.jgit.util.RawParseUtils;
@ -66,7 +67,7 @@ public class ReflogReader {
* @param refname * @param refname
*/ */
public ReflogReader(Repository db, String refname) { public ReflogReader(Repository db, String refname) {
logName = new File(db.getDirectory(), "logs/" + refname); logName = new File(db.getDirectory(), Constants.LOGS + '/' + refname);
} }
/** /**

Loading…
Cancel
Save