You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cn...@apache.org on 2013/10/10 01:13:11 UTC
svn commit: r1530828 - in
/hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common:
CHANGES.txt
src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java
src/test/java/org/apache/hadoop/fs/TestFsShellCopy.java
Author: cnauroth
Date: Wed Oct 9 23:13:10 2013
New Revision: 1530828
URL: http://svn.apache.org/r1530828
Log:
HADOOP-10031. Merging change r1530827 from branch-2 to branch-2.2
Modified:
hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/CHANGES.txt
hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java
hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShellCopy.java
Modified: hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1530828&r1=1530827&r2=1530828&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/CHANGES.txt Wed Oct 9 23:13:10 2013
@@ -17,6 +17,9 @@ Release 2.2.1 - UNRELEASED
HADOOP-10030. FsShell -put/copyFromLocal should support Windows local path.
(Chuan Liu via cnauroth)
+ HADOOP-10031. FsShell -get/copyToLocal/moveFromLocal should support Windows
+ local path. (Chuan Liu via cnauroth)
+
Release 2.2.0 - 2013-10-13
INCOMPATIBLE CHANGES
Modified: hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java?rev=1530828&r1=1530827&r2=1530828&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java (original)
+++ hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java Wed Oct 9 23:13:10 2013
@@ -84,11 +84,16 @@ abstract class CommandWithDestination ex
*/
protected void getLocalDestination(LinkedList<String> args)
throws IOException {
+ String pathString = (args.size() < 2) ? Path.CUR_DIR : args.removeLast();
try {
- String pathString = (args.size() < 2) ? Path.CUR_DIR : args.removeLast();
dst = new PathData(new URI(pathString), getConf());
} catch (URISyntaxException e) {
- throw new IOException("unexpected URISyntaxException", e);
+ if (Path.WINDOWS) {
+ // Unlike URI, PathData knows how to parse Windows drive-letter paths.
+ dst = new PathData(pathString, getConf());
+ } else {
+ throw new IOException("unexpected URISyntaxException", e);
+ }
}
}
Modified: hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShellCopy.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShellCopy.java?rev=1530828&r1=1530827&r2=1530828&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShellCopy.java (original)
+++ hadoop/common/branches/branch-2.2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShellCopy.java Wed Oct 9 23:13:10 2013
@@ -457,6 +457,34 @@ public class TestFsShellCopy {
assertTrue(lfs.exists(srcDir));
}
+ @Test
+ public void testMoveFromWindowsLocalPath() throws Exception {
+ assumeTrue(Path.WINDOWS);
+ Path testRoot = new Path(testRootDir, "testPutFile");
+ lfs.delete(testRoot, true);
+ lfs.mkdirs(testRoot);
+
+ Path target = new Path(testRoot, "target");
+ Path srcFile = new Path(testRoot, new Path("srcFile"));
+ lfs.createNewFile(srcFile);
+
+ String winSrcFile = (new File(srcFile.toUri().getPath()
+ .toString())).getAbsolutePath();
+ shellRun(0, "-moveFromLocal", winSrcFile, target.toString());
+ assertFalse(lfs.exists(srcFile));
+ assertTrue(lfs.exists(target));
+ assertTrue(lfs.isFile(target));
+ }
+
+ @Test
+ public void testGetWindowsLocalPath() throws Exception {
+ assumeTrue(Path.WINDOWS);
+ String winDstFile = (new File(dstPath.toUri().getPath()
+ .toString())).getAbsolutePath();
+ shellRun(0, "-get", srcPath.toString(), winDstFile);
+ checkPath(dstPath, false);
+ }
+
private void createFile(Path ... paths) throws IOException {
for (Path path : paths) {
FSDataOutputStream out = lfs.create(path);