D1729: githelp: don't reference 3rd party commands for `git show`

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Thu Jan 18 14:58:58 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf50067fbeead: githelp: don't reference 3rd party commands for `git show` (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1729?vs=4817&id=4925

REVISION DETAIL
  https://phab.mercurial-scm.org/D1729

AFFECTED FILES
  hgext/githelp.py
  tests/test-githelp.t

CHANGE DETAILS

diff --git a/tests/test-githelp.t b/tests/test-githelp.t
--- a/tests/test-githelp.t
+++ b/tests/test-githelp.t
@@ -177,39 +177,39 @@
 
 githelp for git show --name-status
   $ hg githelp -- git show --name-status
-  hg log --style status -r tip
+  hg log --style status -r .
 
 githelp for git show --pretty=format: --name-status
   $ hg githelp -- git show --pretty=format: --name-status
-  hg stat --change tip
+  hg status --change .
 
 githelp for show with no arguments
   $ hg githelp -- show
-  hg show
+  hg export
 
 githelp for show with a path
   $ hg githelp -- show test_file
-  hg show . test_file
+  hg cat test_file
 
 githelp for show with not a path:
   $ hg githelp -- show rev
-  hg show rev
+  hg export rev
 
 githelp for show with many arguments
   $ hg githelp -- show argone argtwo
-  hg show argone argtwo
+  hg export argone argtwo
   $ hg githelp -- show test_file argone argtwo
-  hg show . test_file argone argtwo
+  hg cat test_file argone argtwo
 
 githelp for show with --unified options
   $ hg githelp -- show --unified=10
-  hg show --config diff.unified=10
+  hg export --config diff.unified=10
   $ hg githelp -- show -U100
-  hg show --config diff.unified=100
+  hg export --config diff.unified=100
 
 githelp for show with a path and --unified
   $ hg githelp -- show -U20 test_file
-  hg show . test_file --config diff.unified=20
+  hg cat test_file --config diff.unified=20
 
 githelp for stash drop without name
   $ hg githelp -- git stash drop
diff --git a/hgext/githelp.py b/hgext/githelp.py
--- a/hgext/githelp.py
+++ b/hgext/githelp.py
@@ -876,23 +876,27 @@
     ]
     args, opts = parseoptions(ui, cmdoptions, args)
 
-    cmd = Command('show')
     if opts.get('name_status'):
         if opts.get('pretty') == 'format:':
-            cmd = Command('stat')
-            cmd['--change'] = 'tip'
+            cmd = Command('status')
+            cmd['--change'] = '.'
         else:
             cmd = Command('log')
             cmd.append('--style status')
-            cmd.append('-r tip')
+            cmd.append('-r .')
     elif len(args) > 0:
         if ispath(repo, args[0]):
-            cmd.append('.')
+            cmd = Command('cat')
+        else:
+            cmd = Command('export')
         cmd.extend(args)
         if opts.get('unified'):
             cmd.append('--config diff.unified=%d' % (opts['unified'],))
     elif opts.get('unified'):
+        cmd = Command('export')
         cmd.append('--config diff.unified=%d' % (opts['unified'],))
+    else:
+        cmd = Command('export')
 
     ui.status((str(cmd)), "\n")
 



To: indygreg, #hg-reviewers, durin42, pulkit, krbullock
Cc: krbullock, pulkit, mercurial-devel


More information about the Mercurial-devel mailing list