2
0
Эх сурвалжийг харах

FileTree: fix rename when target directory wasn't versioned

lviguier 6 сар өмнө
parent
commit
0f728a64d1
1 өөрчлөгдсөн 7 нэмэгдсэн , 3 устгасан
  1. 7 3
      hide/view/FileTree.hx

+ 7 - 3
hide/view/FileTree.hx

@@ -255,11 +255,15 @@ class FileTree extends FileView {
 				if( isDir && !ide.confirm("Renaming a SVN directory, but 'svn' system command was not found. Continue ?") )
 					return false;
 			} else {
-				// Check if file is versioned before using svn rename
-				if (js.node.ChildProcess.spawnSync("svn",["info", ide.getPath(path)]).status == 0) {
+				// Check if origin file and target directory are versioned
+				var isFileVersioned = js.node.ChildProcess.spawnSync("svn",["info", ide.getPath(path)]).status == 0;
+				var newAbsPath = ide.getPath(newPath);
+				var parentFolder = newAbsPath.substring(0, newAbsPath.lastIndexOf('/'));
+				var isDirVersioned = js.node.ChildProcess.spawnSync("svn",["info", parentFolder]).status == 0;
+				if (isFileVersioned && isDirVersioned) {
 					var cwd = Sys.getCwd();
 					Sys.setCwd(ide.resourceDir);
-					var code = Sys.command("svn",["rename",path,newPath]);
+					var code = Sys.command("svn",["rename", path, newPath]);
 					Sys.setCwd(cwd);
 					if( code == 0 )
 						wasRenamed = true;