Lines 3768-3774
Link Here
|
3768 |
|
3768 |
|
3769 |
protected void createBackupFile(String name) { |
3769 |
protected void createBackupFile(String name) { |
3770 |
if (name.endsWith(getBackupExtension()) || isIDESettingsFile(name) || |
3770 |
if (name.endsWith(getBackupExtension()) || isIDESettingsFile(name) || |
3771 |
!getFile(name).exists() || !isImportant(name)) { |
3771 |
!getFile(name).exists()) { // || !isImportant(name)) { |
3772 |
|
3772 |
|
3773 |
return ; |
3773 |
return ; |
3774 |
} |
3774 |
} |
Lines 3898-3920
Link Here
|
3898 |
*/ |
3898 |
*/ |
3899 |
public void lock (final String name) throws IOException { |
3899 |
public void lock (final String name) throws IOException { |
3900 |
//System.out.println("lock("+name+")"); |
3900 |
//System.out.println("lock("+name+")"); |
3901 |
if (!isImportant(name)) return; // ignore locking of unimportant files |
3901 |
File file = getFile (name); |
3902 |
try { // because of adjustment of the thrown exception |
|
|
3903 |
checkModificationLock(name); |
3904 |
//final VcsFileSystem current = this; |
3905 |
final File file = FileUtil.normalizeFile(getFile (name)); |
3906 |
final String filePath = file.getAbsolutePath().intern(); |
3907 |
if (!file.exists()) return; // Ignore the lock when the file does not exist. |
3902 |
if (!file.exists()) return; // Ignore the lock when the file does not exist. |
3908 |
if (isReadOnly()) { // I'm on a read-only filesystem => can not lock |
3903 |
if (isReadOnly()) { // I'm on a read-only filesystem => can not lock |
3909 |
throw new IOException ("Cannot Lock "+name); // NOI18N |
3904 |
throw new IOException ("Cannot Lock "+name); // NOI18N |
3910 |
} |
3905 |
} |
|
|
3906 |
try { // because of adjustment of the thrown exception |
3907 |
checkModificationLock(name); |
3908 |
//final VcsFileSystem current = this; |
3911 |
if (isCallEditFilesOn()) { |
3909 |
if (isCallEditFilesOn()) { |
3912 |
if (!file.canWrite ()) { |
3910 |
if (!file.canWrite () && isImportant(name)) { // ignore editing of unimportant files |
3913 |
FileObject fo = findResource(name); |
3911 |
FileObject fo = findResource(name); |
3914 |
// Get really cached attribute in any case (from memory or disk layer). |
3912 |
// Get really cached attribute in any case (from memory or disk layer). |
3915 |
FileProperties fprops = (FileProperties) FileAttributeQuery.getDefault().readAttribute(fo, FileProperties.ID); |
3913 |
FileProperties fprops = (FileProperties) FileAttributeQuery.getDefault().readAttribute(fo, FileProperties.ID); |
3916 |
boolean local = (fprops != null) ? fprops.isLocal() : false; |
3914 |
boolean local = (fprops != null) ? fprops.isLocal() : false; |
3917 |
if (!local && !name.endsWith (".orig")) { // NOI18N |
3915 |
if (!local && !name.endsWith (".orig")) { // NOI18N |
|
|
3916 |
file = FileUtil.normalizeFile(file); |
3917 |
String filePath = file.getAbsolutePath().intern(); |
3918 |
if (isPromptForEditOn()) { |
3918 |
if (isPromptForEditOn()) { |
3919 |
VcsConfigVariable msgVar = (VcsConfigVariable) variablesByName.get(Variables.MSG_PROMPT_FOR_AUTO_EDIT); |
3919 |
VcsConfigVariable msgVar = (VcsConfigVariable) variablesByName.get(Variables.MSG_PROMPT_FOR_AUTO_EDIT); |
3920 |
String message; |
3920 |
String message; |
Lines 3934-3940
Link Here
|
3934 |
boolean local = fprops != null ? fprops.isLocal() : false; |
3934 |
boolean local = fprops != null ? fprops.isLocal() : false; |
3935 |
// *.orig is a temporary file created by AbstractFileObject |
3935 |
// *.orig is a temporary file created by AbstractFileObject |
3936 |
// on saving every file to enable undo if saving fails |
3936 |
// on saving every file to enable undo if saving fails |
3937 |
if (shouldLock(name) && (local==false) && !name.endsWith (".orig")) { // NOI18N |
3937 |
if (shouldLock(name) && (local==false) && !name.endsWith (".orig") && isImportant(name)) { // NOI18N , ignore locking of unimportant files |
|
|
3938 |
file = FileUtil.normalizeFile(file); |
3939 |
String filePath = file.getAbsolutePath().intern(); |
3938 |
if (isPromptForLockOn ()) { |
3940 |
if (isPromptForLockOn ()) { |
3939 |
VcsConfigVariable msgVar = (VcsConfigVariable) variablesByName.get(Variables.MSG_PROMPT_FOR_AUTO_LOCK); |
3941 |
VcsConfigVariable msgVar = (VcsConfigVariable) variablesByName.get(Variables.MSG_PROMPT_FOR_AUTO_LOCK); |
3940 |
String message; |
3942 |
String message; |
Lines 3947-3956
Link Here
|
3947 |
} |
3949 |
} |
3948 |
} |
3950 |
} |
3949 |
if (!file.canWrite () && file.exists()) { |
3951 |
if (!file.canWrite () && file.exists()) { |
|
|
3952 |
final File ffile = file; |
3950 |
throw new IOException() { |
3953 |
throw new IOException() { |
3951 |
/** Localized message. It should be different from the message. */ |
3954 |
/** Localized message. It should be different from the message. */ |
3952 |
public String getLocalizedMessage () { |
3955 |
public String getLocalizedMessage () { |
3953 |
return g("EXC_CannotLockReadOnly", file.toString()); |
3956 |
return g("EXC_CannotLockReadOnly", ffile.toString()); |
3954 |
} |
3957 |
} |
3955 |
}; |
3958 |
}; |
3956 |
} |
3959 |
} |
Lines 4084-4098
Link Here
|
4084 |
*/ |
4087 |
*/ |
4085 |
public void unlock (String name) { |
4088 |
public void unlock (String name) { |
4086 |
//System.out.println("unlock("+name+")"); |
4089 |
//System.out.println("unlock("+name+")"); |
4087 |
if (!isImportant(name)) return; // ignore unlocking of unimportant files |
|
|
4088 |
|
4089 |
if(isLockFilesOn ()) { |
4090 |
if(isLockFilesOn ()) { |
4090 |
FileObject fo = findResource(name); |
4091 |
FileObject fo = findResource(name); |
4091 |
assert fo != null : "No resource for '"+name+"'"; // NOI18N |
4092 |
assert fo != null : "No resource for '"+name+"'"; // NOI18N |
4092 |
// Get really cached attribute in any case (from memory or disk layer). |
4093 |
// Get really cached attribute in any case (from memory or disk layer). |
4093 |
FileProperties fprops = (FileProperties) FileAttributeQuery.getDefault().readAttribute(fo, FileProperties.ID); |
4094 |
FileProperties fprops = (FileProperties) FileAttributeQuery.getDefault().readAttribute(fo, FileProperties.ID); |
4094 |
boolean local = (fprops != null) ? fprops.isLocal() : false; |
4095 |
boolean local = (fprops != null) ? fprops.isLocal() : false; |
4095 |
if (!local && !name.endsWith (".orig")) { // NOI18N |
4096 |
if (!local && !name.endsWith (".orig") && isImportant(name)) { // NOI18N , ignore unlocking of unimportant files |
4096 |
Command command = createCommand("UNLOCK", name, null); |
4097 |
Command command = createCommand("UNLOCK", name, null); |
4097 |
if (command != null) { |
4098 |
if (command != null) { |
4098 |
boolean customized = VcsManager.getDefault().showCustomizer(command); |
4099 |
boolean customized = VcsManager.getDefault().showCustomizer(command); |