githelp: improve help for `git add`
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 18 Dec 2017 20:51:20 -0800
changeset 35715 8dbd000f7de9
parent 35714 113281667205
child 35716 05b8adf38c55
githelp: improve help for `git add` The old code was referencing record and crecord, which are deprecated. `hg commit --interactive` is the preferred mechanism to use. In addition, there was duplicate code in this function. It has been removed. Tests have been added to cover this function. Differential Revision: https://phab.mercurial-scm.org/D1723
hgext/githelp.py
tests/test-githelp.t
--- a/hgext/githelp.py	Mon Dec 18 20:44:59 2017 -0800
+++ b/hgext/githelp.py	Mon Dec 18 20:51:20 2017 -0800
@@ -156,10 +156,9 @@
     args, opts = parseoptions(ui, cmdoptions, args)
 
     if (opts.get('patch')):
-        ui.status(_("note: hg crecord has a better UI to record changes\n"))
-        ui.status(_("note: record and crecord will commit when complete, "
-                    "as there is no staging area in mercurial\n\n"))
-        cmd = Command('record')
+        ui.status(_("note: Mercurial will commit when complete, "
+                    "as there is no staging area in Mercurial\n\n"))
+        cmd = Command('commit --interactive')
     else:
         cmd = Command("add")
 
@@ -168,11 +167,6 @@
         else:
             ui.status(_("note: use hg addremove to remove files that have "
                         "been deleted.\n\n"))
-        if not opts.get('all'):
-            cmd.extend(args)
-        else:
-            ui.status(_("note: use hg addremove to remove files that have "
-                        "been deleted.\n\n"))
 
     ui.status((str(cmd)), "\n")
 
--- a/tests/test-githelp.t	Mon Dec 18 20:44:59 2017 -0800
+++ b/tests/test-githelp.t	Mon Dec 18 20:51:20 2017 -0800
@@ -256,3 +256,18 @@
 githelp for git blame
   $ hg githelp -- git blame
   hg annotate -udl
+
+githelp for add
+
+  $ hg githelp -- git add
+  hg add
+
+  $ hg githelp -- git add -p
+  note: Mercurial will commit when complete, as there is no staging area in Mercurial
+  
+  hg commit --interactive
+
+  $ hg githelp -- git add --all
+  note: use hg addremove to remove files that have been deleted.
+  
+  hg add