[PATCH 1 of 3] commands: add example for 'hg add'

Mathias De Maré mathias.demare at gmail.com
Wed Nov 25 19:44:51 UTC 2015


# HG changeset patch
# User Mathias De Maré <mathias.demare at gmail.com>
# Date 1448471431 -3600
#      Wed Nov 25 18:10:31 2015 +0100
# Node ID 1c6ef9675a267afecc90657bda0463a750c9bfd9
# Parent  61fbf5dc12b23e7a2a30cf04ebd9f096c42a1f61
commands: add example for 'hg add'

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -191,17 +191,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.
     """
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -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:
   
-        $ ls
-        foo.c
-        $ hg status
-        ? foo.c
-        $ hg add
-        adding foo.c
-        $ hg status
-        A foo.c
+        - 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.
   
@@ -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 "hg add":
+  Examples:
   </p>
+  <ul>
+   <li> New (unknown) files are added   automatically by "hg add":
   <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>


More information about the Mercurial-devel mailing list