changeset 27143:fab21bac1024

commands: add example for 'hg add'
author Mathias De Maré <mathias.demare@gmail.com>
date Wed, 25 Nov 2015 18:10:31 +0100
parents 060f83d219b9
children 24440cc7b441
files mercurial/commands.py tests/test-help.t
diffstat 2 files changed, 64 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Nov 24 15:16:25 2015 -0800
+++ b/mercurial/commands.py	Wed Nov 25 18:10:31 2015 +0100
@@ -190,17 +190,31 @@
 
     .. container:: verbose
 
-       An example showing how new (unknown) files are added
-       automatically by :hg:`add`::
-
-         $ ls
-         foo.c
-         $ hg status
-         ? foo.c
-         $ hg add
-         adding foo.c
-         $ hg status
-         A foo.c
+       Examples:
+
+         - New (unknown) files are added
+           automatically by :hg:`add`::
+
+             $ ls
+             foo.c
+             $ hg status
+             ? foo.c
+             $ hg add
+             adding foo.c
+             $ hg status
+             A foo.c
+
+         - Specific files to be added can be specified::
+
+             $ ls
+             bar.c  foo.c
+             $ hg status
+             ? bar.c
+             ? foo.c
+             $ hg add bar.c
+             $ hg status
+             A bar.c
+             ? foo.c
 
     Returns 0 if all files are successfully added.
     """
--- a/tests/test-help.t	Tue Nov 24 15:16:25 2015 -0800
+++ b/tests/test-help.t	Wed Nov 25 18:10:31 2015 +0100
@@ -372,17 +372,30 @@
   
       If no names are given, add all files to the repository.
   
-      An example showing how new (unknown) files are added automatically by "hg
-      add":
+      Examples:
+  
+        - New (unknown) files are added automatically by "hg add":
   
-        $ ls
-        foo.c
-        $ hg status
-        ? foo.c
-        $ hg add
-        adding foo.c
-        $ hg status
-        A foo.c
+            $ ls
+            foo.c
+            $ hg status
+            ? foo.c
+            $ hg add
+            adding foo.c
+            $ hg status
+            A foo.c
+  
+        - Specific files to be added can be specified:
+  
+            $ ls
+            bar.c  foo.c
+            $ hg status
+            ? bar.c
+            ? foo.c
+            $ hg add bar.c
+            $ hg status
+            A bar.c
+            ? foo.c
   
       Returns 0 if all files are successfully added.
   
@@ -1995,9 +2008,10 @@
   If no names are given, add all files to the repository.
   </p>
   <p>
-  An example showing how new (unknown) files are added
-  automatically by &quot;hg add&quot;:
+  Examples:
   </p>
+  <ul>
+   <li> New (unknown) files are added   automatically by &quot;hg add&quot;:
   <pre>
   \$ ls (re)
   foo.c
@@ -2008,6 +2022,19 @@
   \$ hg status (re)
   A foo.c
   </pre>
+   <li> Specific files to be added can be specified:
+  <pre>
+  \$ ls (re)
+  bar.c  foo.c
+  \$ hg status (re)
+  ? bar.c
+  ? foo.c
+  \$ hg add bar.c (re)
+  \$ hg status (re)
+  A bar.c
+  ? foo.c
+  </pre>
+  </ul>
   <p>
   Returns 0 if all files are successfully added.
   </p>