Mercurial > jhg
annotate src/org/tmatesoft/hg/repo/HgInvalidControlFileException.java @ 704:7743a9c10bfa
Merge command introduced
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Wed, 14 Aug 2013 20:07:26 +0200 | 
| parents | 6526d8adbc0f | 
| children | 
| rev | line source | 
|---|---|
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 1 /* | 
| 628 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 2 * Copyright (c) 2011-2013 TMate Software Ltd | 
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 3 * | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 4 * This program is free software; you can redistribute it and/or modify | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 5 * it under the terms of the GNU General Public License as published by | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 6 * the Free Software Foundation; version 2 of the License. | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 7 * | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 8 * This program is distributed in the hope that it will be useful, | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 11 * GNU General Public License for more details. | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 12 * | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 13 * For information on how to redistribute this software under | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 14 * the terms of a license other than GNU General Public License | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 15 * contact TMate Software at support@hg4j.com | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 16 */ | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
396diff
changeset | 17 package org.tmatesoft.hg.repo; | 
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 18 | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 19 import java.io.File; | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 20 | 
| 628 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 21 import org.tmatesoft.hg.core.HgIOException; | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
396diff
changeset | 22 import org.tmatesoft.hg.core.Nodeid; | 
| 396 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 23 import org.tmatesoft.hg.util.Path; | 
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 24 | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 25 /** | 
| 335 
3d41dc148d14
Do not fail with exception on syntax errors in .hgignore
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
318diff
changeset | 26 * Subclass of {@link HgInvalidFileException} to indicate failure to deal with one of <b>Mercurial</b> control files | 
| 
3d41dc148d14
Do not fail with exception on syntax errors in .hgignore
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
318diff
changeset | 27 * (most likely those under .hg/, but also those residing in the repository, with special meaning to the Mercurial, like .hgtags or .hgignore) | 
| 396 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 28 * | 
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 29 * @author Artem Tikhomirov | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 30 * @author TMate Software Ltd. | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 31 */ | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 32 @SuppressWarnings("serial") | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 33 public class HgInvalidControlFileException extends HgInvalidFileException { | 
| 467 
51d682cf9cdc
Cleaned experimental tag and updated comments/javadoc
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
423diff
changeset | 34 // XXX Perhaps, child HgInvalidRevlogException and parent HgInvalidRepositoryFileException? | 
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 35 | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 36 public HgInvalidControlFileException(String message, Throwable th, File file) { | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 37 super(message, th, file); | 
| 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 38 } | 
| 628 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 39 | 
| 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 40 public HgInvalidControlFileException(HgIOException ex, boolean replaceStackTrace) { | 
| 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 41 super(ex.getMessage(), ex.getCause(), ex.getFile()); | 
| 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 42 if (replaceStackTrace) { | 
| 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 43 setStackTrace(ex.getStackTrace()); | 
| 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 44 } | 
| 
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
467diff
changeset | 45 } | 
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 46 | 
| 348 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
335diff
changeset | 47 @Override | 
| 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
335diff
changeset | 48 public HgInvalidControlFileException setFile(File file) { | 
| 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
335diff
changeset | 49 super.setFile(file); | 
| 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
335diff
changeset | 50 return this; | 
| 
a0864b2892cd
Expose errors reading mercurial control files with exception
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
335diff
changeset | 51 } | 
| 354 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
348diff
changeset | 52 | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
348diff
changeset | 53 @Override | 
| 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
348diff
changeset | 54 public HgInvalidControlFileException setRevision(Nodeid r) { | 
| 396 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 55 return (HgInvalidControlFileException) super.setRevision(r); | 
| 354 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
348diff
changeset | 56 } | 
| 394 
f52ca9530774
Resolve FIXMEs: more consistent exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 57 | 
| 
f52ca9530774
Resolve FIXMEs: more consistent exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 58 @Override | 
| 396 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 59 public HgInvalidControlFileException setRevisionIndex(int rev) { | 
| 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 60 return (HgInvalidControlFileException) super.setRevisionIndex(rev); | 
| 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 61 } | 
| 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 62 | 
| 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 63 @Override | 
| 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 64 public HgInvalidControlFileException setFileName(Path name) { | 
| 
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
394diff
changeset | 65 return (HgInvalidControlFileException) super.setFileName(name); | 
| 394 
f52ca9530774
Resolve FIXMEs: more consistent exceptions
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 66 } | 
| 318 
c3d2233ba842
Shall propagate errors to clients, not work around them silently
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 67 } | 
