annotate tests/test-symlinks @ 1587:851bc33ff545

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.
author Daniel Kobras <kobras@debian.org>
date Thu, 15 Dec 2005 15:40:14 +0100
parents c13fce7167c2
children 6c61646fee5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1408
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
1 #!/bin/sh
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
2 #Test bug regarding symlinks that showed up in hg 0.7
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
3 #Author: Matthew Elder <sseses@gmail.com>
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
4
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
5 #make and initialize repo
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
6 hg init test; cd test;
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
7
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
8 #make a file and a symlink
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
9 touch foo; ln -s foo bar;
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
10
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
11 #import with addremove -- symlink walking should _not_ screwup.
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
12 hg addremove
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
13
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
14 #commit -- the symlink should _not_ appear added to dir state
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
15 hg commit -m 'initial'
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
16
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
17 #add a new file so hg will let me commit again
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
18 touch bomb
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
19
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
20 #again, symlink should _not_ show up on dir state
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
21 hg addremove
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
22
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
23 #Assert screamed here before, should go by without consequence
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
24 hg commit -m 'is there a bug?'
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
25
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
26 cd .. ; rm -rf test
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
27 hg init test; cd test;
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
28
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
29 mkdir dir
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
30 touch a.c dir/a.o dir/b.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
31 # test what happens if we want to trick hg
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
32 hg commit -A -m 0
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
33 echo "relglob:*.o" > .hgignore
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
34 rm a.c
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
35 rm dir/a.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
36 rm dir/b.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
37 mkdir dir/a.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
38 ln -sf nonexist dir/b.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
39 mkfifo a.c
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
40 # it should show a.c, dir/a.o and dir/b.o removed
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
41 hg status
1527
c13fce7167c2 don't print anything about file of unsupported type unless
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1487
diff changeset
42 hg status a.c