Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B2291098E for ; Thu, 15 Jan 2015 16:11:07 +0000 (UTC) Received: (qmail 693 invoked by uid 500); 15 Jan 2015 16:11:04 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 628 invoked by uid 500); 15 Jan 2015 16:11:04 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 619 invoked by uid 99); 15 Jan 2015 16:11:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jan 2015 16:11:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AF53DA447BA; Thu, 15 Jan 2015 16:11:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aajisaka@apache.org To: common-commits@hadoop.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: HADOOP-11318. Update the document for hadoop fs -stat Date: Thu, 15 Jan 2015 16:11:03 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/branch-2 b349cd9d0 -> 8682382c1 HADOOP-11318. Update the document for hadoop fs -stat (cherry picked from commit ce29074685abaa88ae9586fe8277aca23f9d54d6) Conflicts: hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8682382c Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8682382c Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8682382c Branch: refs/heads/branch-2 Commit: 8682382c16fa1adecd7ab862eef91ef2e9268b21 Parents: b349cd9 Author: Akira Ajisaka Authored: Fri Jan 16 00:55:20 2015 +0900 Committer: Akira Ajisaka Committed: Fri Jan 16 01:09:37 2015 +0900 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../java/org/apache/hadoop/fs/shell/Stat.java | 33 +++++++++++++------- .../src/site/apt/FileSystemShell.apt.vm | 11 +++++-- .../src/test/resources/testConf.xml | 24 +++++++++++--- 4 files changed, 51 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8682382c/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 4579eb1..3a91971 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -136,6 +136,8 @@ Release 2.7.0 - UNRELEASED BUG FIXES + HADOOP-11318. Update the document for hadoop fs -stat (aajisaka) + HADOOP 11400. GraphiteSink does not reconnect to Graphite after 'broken pipe' (Kamil Gorlo via raviprak) http://git-wip-us.apache.org/repos/asf/hadoop/blob/8682382c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java index 6365294..458d3ee 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java @@ -30,15 +30,17 @@ import org.apache.hadoop.fs.FileStatus; /** * Print statistics about path in specified format. - * Format sequences: - * %b: Size of file in blocks - * %g: Group name of owner - * %n: Filename - * %o: Block size - * %r: replication - * %u: User name of owner - * %y: UTC date as "yyyy-MM-dd HH:mm:ss" - * %Y: Milliseconds since January 1, 1970 UTC + * Format sequences:
+ * %b: Size of file in blocks
+ * %F: Type
+ * %g: Group name of owner
+ * %n: Filename
+ * %o: Block size
+ * %r: replication
+ * %u: User name of owner
+ * %y: UTC date as "yyyy-MM-dd HH:mm:ss"
+ * %Y: Milliseconds since January 1, 1970 UTC
+ * If the format is not specified, %y is used by default. */ @InterfaceAudience.Private @InterfaceStability.Unstable @@ -48,12 +50,19 @@ class Stat extends FsCommand { factory.addClass(Stat.class, "-stat"); } + private static final String NEWLINE = System.getProperty("line.separator"); + public static final String NAME = "stat"; public static final String USAGE = "[format] ..."; public static final String DESCRIPTION = - "Print statistics about the file/directory at " + - "in the specified format. Format accepts filesize in blocks (%b), group name of owner(%g), " + - "filename (%n), block size (%o), replication (%r), user name of owner(%u), modification date (%y, %Y)\n"; + "Print statistics about the file/directory at " + NEWLINE + + "in the specified format. Format accepts filesize in" + NEWLINE + + "blocks (%b), type (%F), group name of owner (%g)," + NEWLINE + + "name (%n), block size (%o), replication (%r), user name" + NEWLINE + + "of owner (%u), modification date (%y, %Y)." + NEWLINE + + "%y shows UTC date as \"yyyy-MM-dd HH:mm:ss\" and" + NEWLINE + + "%Y shows milliseconds since January 1, 1970 UTC." + NEWLINE + + "If the format is not specified, %y is used by default." + NEWLINE; protected final SimpleDateFormat timeFmt; { http://git-wip-us.apache.org/repos/asf/hadoop/blob/8682382c/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm b/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm index abc4643..c43c517 100644 --- a/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm +++ b/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm @@ -558,13 +558,18 @@ setrep stat - Usage: <<>> + Usage: << ...>>> - Returns the stat information on the path. + Print statistics about the file/directory at \ in the specified + format. Format accepts filesize in blocks (%b), type (%F), group name of + owner (%g), name (%n), block size (%o), replication (%r), user name of + owner(%u), and modification date (%y, %Y). %y shows UTC date as + "yyyy-MM-dd HH:mm:ss" and %Y shows milliseconds since January 1, 1970 UTC. + If the format is not specified, %y is used by default. Example: - * <<>> + * <<>> Exit Code: Returns 0 on success and -1 on error. http://git-wip-us.apache.org/repos/asf/hadoop/blob/8682382c/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml b/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml index dcf8fb4..f93399c 100644 --- a/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml +++ b/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml @@ -786,19 +786,35 @@ RegexpComparator - ^( |\t)*Print statistics about the file/directory at <path> in the specified format.( )* + ^( |\t)*Print statistics about the file/directory at <path>( )* RegexpComparator - ^( |\t)*Format accepts filesize in blocks \(%b\), group name of owner\(%g\), filename \(%n\),( )* + ^( |\t)*in the specified format. Format accepts filesize in( )* RegexpComparator - ^( |\t)*block size \(%o\), replication \(%r\), user name of owner\(%u\), modification date( )* + ^( |\t)*blocks \(%b\), type \(%F\), group name of owner \(%g\),( )* RegexpComparator - ^( |\t)*\(%y, %Y\)( )* + ^( |\t)*name \(%n\), block size \(%o\), replication \(%r\), user name( )* + + + RegexpComparator + ^( |\t)*of owner \(%u\), modification date \(%y, %Y\).( )* + + + RegexpComparator + ^( |\t)*%y shows UTC date as "yyyy-MM-dd HH:mm:ss" and( )* + + + RegexpComparator + ^( |\t)*%Y shows milliseconds since January 1, 1970 UTC.( )* + + + RegexpComparator + ^( |\t)*If the format is not specified, %y is used by default.( )*