Commit Graph

88 Commits

Author SHA1 Message Date
Alexis S. L. Carvalho
648f8acf27 bash_completion: qdelete --rev 2006-10-22 01:01:45 -03:00
Alexis S. L. Carvalho
f8066a6345 bash_completion: make export fall back to tags when there's no mq patch applied 2006-10-22 01:01:42 -03:00
Alexis S. L. Carvalho
e6c66d1351 bash_completion: don't complete export with "garbage" when mq is not around
The "garbage" is the output of hg help printed when a command is not found.
2006-10-22 01:01:03 -03:00
Mathieu Clabaut ext:(%22)
465e0ef538 Improve bash_completion for patches in MQ 2006-07-26 20:15:31 +02:00
Alexis S. L. Carvalho
c5f6f508f5 bash_completion: completion for commands provided by extensions
Make the bash_completion function call _hg_cmd_$cmd to generate
completion candidates for $cmd if that function exists.

Add basic completion functions for:

- mq:
  - qpop
  - qpush
  - qdelete
  - qsave
  - qcommit
  - strip

- hbisect:
  - bisect

- patchbomb:
  - email

- gpg:
  - sign
2006-04-03 14:56:00 +02:00
Alexis S. L. Carvalho
bb83bf89db bash_completion: small optimization
Right now we always call "hg help $cmd" to get the canonical name of $cmd
(i.e. to go from "co" to "update").

This patch optimistically assumes that $cmd is already the canonical form
and tries to generate completions for it.  If that fails, it falls back
to canonicalizing $cmd and trying again.

This means that:

- if a command or alias is explicitly handled by the
  _hg_command_specific function, things get somewhat faster

- as long as the canonical $cmd is handled by _hg_command_specific, all
  its aliases and abbreviations are also handled.
2006-04-02 18:20:52 +02:00
Thomas Arendsen Hein
7bd3e367e7 Make 'hg tags -q' only list tag names without revision numbers and hashes,
and change bash_completion to use this.
2006-04-01 23:57:24 +02:00
Alexis S. L. Carvalho
b5be2f0b92 add --options to debugcomplete and change bash_completion to use it
make debugcomplete print one item per line (this is not needed for the
bash_completion script, but should be easier to use in other scripts)
2006-04-01 22:50:12 +02:00
Thomas Arendsen Hein
0a049bc1ef Make bash_completion more robust for e.g. broken hgrc or old hg installations. 2006-03-12 12:29:03 +01:00
Benoit Boissinot
8c2989d646 new command debugcomplete
add a new command debugcomplete, it lists all the possible
completion for the specified command.
make the bash_completion script uses it instead of the awk code
2006-03-12 11:32:03 +01:00
Alexis S. L. Carvalho
9a000b91a7 Really fix bash_completion on Solaris. Maybe. Hopefully.
Use substr instead of sub.
2006-03-01 14:52:28 +01:00
Alexis S. L. Carvalho
6ba2866bba Fix bash_completion on Solaris
TK Soh noticed that the awk that ships with Solaris doesn't allow you
to define new functions.  According to
http://www.shelldorado.com/articles/awkcompat.html
it looks like it also doesn't have some other stuff that we were using,
like deletion of an array element and gsub.

Rewrite the parsing of hg --debug help to work around that. This
version doesn't filter aliases that are simple abbreviations for debug
commands (not a big problem, since there are none right now).
2006-02-28 11:49:35 -06:00
Thomas Arendsen Hein
df5b521a79 Cleanup of spacing in bash_completion 2006-02-02 08:16:17 +01:00
Thomas Arendsen Hein
d64ca73426 Use user specified path to hg in bash_completion
e.g. for multiple installs with different versions or extensions.
2006-02-02 07:50:20 +01:00
Alexis S. L. Carvalho
12832e1570 bash_completion: ignore hg help error messages
They are usually not useful when you're completing stuff and end up
cluttering the screen.
2006-01-27 12:15:39 +01:00
Alexis S. L. Carvalho
01b4cbf805 bash_completion: always use single quotes with compgen -W
This avoids a bug in bash 2.05a
2006-01-27 12:11:14 +01:00
Alexis S. L. Carvalho
af689bde09 bash_completion: be more careful about whitespaces
- use awk to parse the output of hg help.
- print one completion candidate per line
- print the debug commands after regular commands
  (this eases the shell side of the parsing)
- don't print aliases that are simple abbreviations
  (e.g. up/update, id/identify)
2006-01-27 12:10:35 +01:00
Thomas Arendsen Hein
2ac2a1e7e3 _hg_status improvements in bash_completion:
- Use "hg status -n" option instead of cut command.
- Sort status flags accoring to "hg status --help"
- Show deleted files instead of "hg remove"d for "hg remove"
2006-01-26 15:07:46 +01:00
Alexis S. L. Carvalho
606e1d0e53 bash_completion: small updates and fixes
- $result in _hg_commands is not an array
- use "hg status ."
- update "hg cat" completion
- let bash itself generate the default completion
2006-01-26 14:52:26 +01:00
Daniel Kobras
a3a420907c Less annoying directory completion (see http://bugs.debian.org/343458)
The current bash completion script is quite painful in conjuntion with
deep directory trees because it adds a space after each successful
directory completion. Eg. "hg clone /ho<tab>" is completed to "hg clone
/home " when what you really want is "hg clone /home/" (assuming the
complete path to the repository looks like /home/foo/hg...).

That's because the 'complete' command does not know about the type of
completion it receives from the _hg shell function. When only a single
completion is returned, it assumes completion is complete and tells
readline to add a trailing space. This behaviour is usually wanted, but
not in the case of directory completion.

I've attached a patch that circumvents this problem by only returning
successful completions for directories that contain a .hg subdirectory.
If no repositories are found, no completions are returned either, and
bash falls back to ordinary (filename) completion. I find this behaviour
a lot less annoying than the current one.

Alternative: Use option nospace for the 'complete' command and let _hg
itself take care of adding a trailing space where appropriate. That's a
far more intrusive change, though.
2005-12-15 15:40:14 +01:00
Thomas Arendsen Hein
f2525190a2 Space/Tab cleanup in bash_completion. 2005-11-23 08:07:27 +01:00
Alexis S. L. Carvalho
5bb8e5ebbc bash_completion: use hg --debug help to get the list of debug commands.
Also, try completing with the debug commands only when there's no other
candidates.

Based on an idea by TK Soh.
2005-11-23 08:02:35 +01:00
Vincent Danjean
0c1cbacb8a bash_completion is not an executable
Index: hg/contrib/bash_completion
===================================================================
--- hg.orig/contrib/bash_completion	2005-09-22 09:40:47.000000000 -0700
+++ hg/contrib/bash_completion	2005-09-23 18:32:46.000000000 -0700
@@ -1,5 +1,3 @@
-#!/bin/bash
-
 shopt -s extglob

 _hg_commands()
2005-09-23 18:58:48 -07:00
TK Soh
c5b7848e50 bash_completion: extended patterns require extglob option 2005-09-21 09:02:41 +02:00
Thomas Arendsen Hein
455a56454d Cleanup of tabs and trailing spaces. 2005-09-21 07:56:19 +02:00
Thomas Arendsen Hein
e72fd19edc Added new debug commands to bash_completion. 2005-09-16 21:31:31 +02:00
Alexis S. L. Carvalho
d3995fac64 bash_completion: try to use bash3 features if they're available
This does NOT break completion for bash 2.05b (I haven't tested
earlier versions)
2005-08-29 20:37:07 +02:00
Alexis S. L. Carvalho
d75704cfb1 bash_completion: small cleanup and bugfix
_hg_count_non_option wasn't taking global options into account
while counting non-option arguments.

It also used only its first argument.
2005-08-29 20:37:07 +02:00
Alexis S. L. Carvalho
098e537d63 teach bash_completion about --cwd 2005-08-29 20:37:07 +02:00
Alexis S. L. Carvalho
c499be626e bash_completion: better handling of aliases
Instead of listing every alias in the big case..esac, use hg help
to get the canonical name of the command.
2005-08-29 20:37:07 +02:00
Alexis S. L. Carvalho
a6928b8448 bash_completion: update for new help output format 2005-08-29 20:37:07 +02:00
mpm@selenic.com
e47546f442 bash_completion: add debugindex and debugdata support 2005-08-27 20:42:53 -07:00
mpm@selenic.com
49b9ae7f87 Add some aliases 2005-08-24 00:12:04 -07:00
TK Soh
fe5a0014c8 bash_completion: support GNU sed 3 and non-GNU sed
replaced command 'Q' introduced in GNU sed 4, in order to support
platforms with older sed.
2005-08-19 06:04:46 +01:00
mpm@selenic.com
a82d31d71f bash: Add smarter completion of add/commit/remove/forget/diff/revert
Use hg status to determine which files are interesting for various commands.
Thus, hg add [tab] finds unknown files, and hg commit [tab] finds added, modified, or removed files.
2005-08-17 12:22:12 -08:00
mpm@selenic.com
7eaff8988b Add incoming to completions 2005-08-16 19:31:30 -08:00
mpm@selenic.com
f2d463a963 Teach bash_completion about outgoing 2005-08-16 15:55:33 -08:00
mpm@selenic.com
fe60cec7c8 Add bash_completion to contrib
Contributed by "Alexis S. L. Carvalho" <alexis@cecm.usp.br>

Attached is a file that implements bash completion for hg.  Just
reading it from your .bashrc should be enough to use it - I think: I'm
using the /etc/bash_completion from debian and I'm not sure whether it
sets some important option.

It gets the list of commands, aliases and options from the output of hg
help and then adds some specific stuff - e.g. completing update with
tags; pull and push with path aliases and directories, etc.
2005-08-16 14:17:27 -08:00