Since we don't switch the window anymore, we can't simply refer to b:sy as we
used to do while Sy worked only synchronously.
Now we provide the buffer number to each job and the exit handler gets a pointer
to the b:sy of that buffer and passes it to all the subsequent functions.
References #209, #210.
Vim provides 2 arguments to the exit handler whereas Neovim always provides 3.
Change function signature to handle an optional third argument, even if it never
gets used.
Fixes#204.
When a user isn't logged in, "accurev diff" will return an exit code of
52. Since the only well defined values are 0 or 1, treat anything else
as unversioned.
"accurev diff" returns 0 for no diff, 1 for differences, and 2 for error
(like not being run from a workspace). Use 2 to indicate the file isn't
being versioned by AccuRev so Sy properly sets the vcs type to AccuRev
for unmodified files.
Previously, when using *nix csh-like (or probably ksh-like) shells, perforce
detection would fail with E484. This was due to hard-coded bash-like
redirection.
This change obeys the vim `shellredir` option when detecting perforce.
Use split() instead of substitute(), since the latter simply parses strings
and doesn't understand the notion of path separators. Backslashes would be
interpreted as beginning escape sequences.
Using split() works around this problem.
Closes#163.
This merge removes g:signify_diffoptions and replaces it by the much more
general g:signify_vcs_commands. Users can customize the entire command to be
run now.
This reverts commit 5cdf72acd1.
`shellescape()`, which is what `sy#util#escape()` is a front-end to, is
only supposed to escape a single element of an argv list. In this case,
it's being used to escape multiple -- `p4 info 2>&1 >`. None of that
should be escaped anyway, because they need to be interpreted by the
shell.
“p4 monitor info” isn't always available and can impose a heavy runtime
cost when it is if the server isn't responsive.
Closesmhinz/vim-signify#153
Signed-off-by: James McCoy <vega.james@gmail.com>
This handles the case where a user forces colors from the color extension via
hgrc:
[extensions]
color =
[defaults]
diff = --colors=always
Sy disables these for its 'hg diff' call, otherwise the output would be
riddled with color escape sequences and couldn't be parsed properly which
would result in no signs shown.
References #146.
Mercurial's detection for where a file's containing repo is doesn't work
well when the working directory is a different Mercurial repo (c.f.,
mhinz/vim-signify#146). Run "hg diff" from the target file's parent
directory to work around this.
Signed-off-by: James McCoy <vega.james@gmail.com>
If there are more than 99 deleted lines, the actual count isn't being
important anymore. Thus we just let it overflow and save another
conditional.
100 deleted lines -> "00"
Closes#109.
Defining the SignifyDelete set of signs on the fly provides the ability
to specify the exact line deletion count for up to 99 lines, rather than
the current limit of 9 lines.
This also has the benefit of reducing the number of signs defined when
there aren't many hunks of deleted lines. On the flip side, if there
are other sign-placing plugins in use, then it also increases the chance
of nearing the ~120 sign definition limit if there are many hunks of
varying line deletions.
Prior to this patch, it was not possible to dynamically apply arguments
to diff commands. The g:signify_diffoptions variable was only read when
the plugin was loaded.
This patch changes the behavior so that before each diff it checks
g:signify_diffoptions to see what arguments should be passed to the diff
tool.
The motivating use case behind this change is to be able to diff against
a different branch in Git via a key mapping. However, This change will
also allow any other arbitrary diff options to be dynamically updated,
such as whitespace, etc.
Example: Show diff against master instead of against HEAD in Git
nnoremap \u :let g:signify_diffoptions = { 'git': 'master'}<CR>:SignifyToggle<CR>
Prior to this patch a VCS was only detected by checking if a potential
diff was empty or not. Now the combination of return value and diff is
checked, so it detects an underlying VCS properly even when there are no
changes.
This can save many useless calls to the wrong version control systems.
Simple test:
- open a version-controlled file without any changes
- :SyDebug should show the correct VCS now (instead of 'unknown')
Closes#82.
After one of the recent changes 'deleted' was used in a place where
'removed' should have been used. This could lead errors:
Error detected while processing function
sy#toggle..sy#start..sy#repo#process_diff..sy#sign#set:
line 10:
E155: Unknown sign: SignifyChangeDelete12
ANSI escape sequences in a patch would confuse Sy. People are advised to
set their color settings to 'auto' instead of 'always', so color codes
would only be used if the output is meant for the terminal.
Thus we just ignore color.diff settings now.
References #72.