Mercurial > hg
annotate hgext/graphlog.py @ 23391:d8cdd46f426d
add: check for the existence of a file matched inexactly before adding it
The change in 10697f29af2b created a problem on Windows and OS X:
--- /usr/local/mercurial/tests/test-issue660.t
+++ /usr/local/mercurial/tests/test-issue660.t.err
@@ -47,6 +47,8 @@
Should succeed - shadow removed:
$ hg add b
+ adding b/b
+ b/b does not exist!
Prior to the failing 'hg add', the file 'b/b' was added and committed, then 'b'
was recursively deleted from the filesystem, file 'b' was created and the delete
was recorded with 'hg rm --after'. This add is attempting to record the
existence of file 'b'.
A filesystem that is not case sensitive prevents dirstate.walk() from skipping
its step 3, and step 3 has the effect of inserting removed files into the walk
list. The Linux code doesn't run through step 3, and didn't exhibit the
problem. It's not clear why a non case sensitive filesystem triggers step 3,
given that the path normalization occurs in step 2.
Prior to 10697f29af2b, part of the check here was 'f not in repo.dirstate'
instead of 'f not in wctx'. Files in the 'r' state are filtered out of
context.__contains__() but not dirstate.__contains__(). Therefore the removed
file name wasn't added to the list of files to add when checking against
dirstate. That change was to allow removed files to be readded, but adding a
file that doesn't exist is nonsensical. If the user specifies a missing file,
it will be an exact match and will still fail.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 19 Nov 2014 22:27:55 -0500 |
parents | 8d43c6bb38c0 |
children | 8e1f1673aa9a |
rev | line source |
---|---|
4344 | 1 # ASCII graph log extension for Mercurial |
2 # | |
3 # Copyright 2007 Joel Rosdahl <joel@rosdahl.net> | |
4516
96d8a56d4ef9
Removed trailing whitespace and tabs from python files
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4509
diff
changeset
|
4 # |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
8210
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
10263 | 6 # GNU General Public License version 2 or any later version. |
8228
eee2319c5895
add blank line after copyright notices and after header
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
7 |
20118
6ed9141151bf
graphlog: mark as deprecated
Martin Geisler <martin@geisler.net>
parents:
18267
diff
changeset
|
8 '''command to view revision graphs from a shell (DEPRECATED) |
6ed9141151bf
graphlog: mark as deprecated
Martin Geisler <martin@geisler.net>
parents:
18267
diff
changeset
|
9 |
6ed9141151bf
graphlog: mark as deprecated
Martin Geisler <martin@geisler.net>
parents:
18267
diff
changeset
|
10 The functionality of this extension has been include in core Mercurial |
6ed9141151bf
graphlog: mark as deprecated
Martin Geisler <martin@geisler.net>
parents:
18267
diff
changeset
|
11 since version 2.3. |
7426
df0962f6c54e
Graphlog extension adds a --graph option to log/in/out
Alpar Juttner <alpar@cs.elte.hu>
parents:
7383
diff
changeset
|
12 |
df0962f6c54e
Graphlog extension adds a --graph option to log/in/out
Alpar Juttner <alpar@cs.elte.hu>
parents:
7383
diff
changeset
|
13 This extension adds a --graph option to the incoming, outgoing and log |
9259
19a4b8fd5c48
graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9198
diff
changeset
|
14 commands. When this options is given, an ASCII representation of the |
19a4b8fd5c48
graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9198
diff
changeset
|
15 revision graph is also shown. |
7426
df0962f6c54e
Graphlog extension adds a --graph option to log/in/out
Alpar Juttner <alpar@cs.elte.hu>
parents:
7383
diff
changeset
|
16 ''' |
4344 | 17 |
18 from mercurial.i18n import _ | |
17182
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
19 from mercurial import cmdutil, commands |
5938
9ed100559851
graphlog: add filelog revision grapher
Steve Borho <steve@borho.org>
parents:
4735
diff
changeset
|
20 |
14311
9bbac962f4dd
graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents:
14139
diff
changeset
|
21 cmdtable = {} |
9bbac962f4dd
graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents:
14139
diff
changeset
|
22 command = cmdutil.command(cmdtable) |
16743
38caf405d010
hgext: mark all first-party extensions as such
Augie Fackler <raf@durin42.com>
parents:
16434
diff
changeset
|
23 testedwith = 'internal' |
14311
9bbac962f4dd
graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents:
14139
diff
changeset
|
24 |
9bbac962f4dd
graphlog: use cmdutil.command decorator
Adrian Buehlmann <adrian@cadifra.com>
parents:
14139
diff
changeset
|
25 @command('glog', |
16432
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
26 [('f', 'follow', None, |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
27 _('follow changeset history, or file history across copies and renames')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
28 ('', 'follow-first', None, |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
29 _('only follow the first parent of merge changesets (DEPRECATED)')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
30 ('d', 'date', '', _('show revisions matching date spec'), _('DATE')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
31 ('C', 'copies', None, _('show copied files')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
32 ('k', 'keyword', [], |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
33 _('do case-insensitive search for a given text'), _('TEXT')), |
23091
8d43c6bb38c0
doc: change 'revision or range' to 'revision or revset'
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
21782
diff
changeset
|
34 ('r', 'rev', [], _('show the specified revision or revset'), _('REV')), |
16432
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
35 ('', 'removed', None, _('include revisions where files were removed')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
36 ('m', 'only-merges', None, _('show only merges (DEPRECATED)')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
37 ('u', 'user', [], _('revisions committed by user'), _('USER')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
38 ('', 'only-branch', [], |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
39 _('show only changesets within the given named branch (DEPRECATED)'), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
40 _('BRANCH')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
41 ('b', 'branch', [], |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
42 _('show changesets within the given named branch'), _('BRANCH')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
43 ('P', 'prune', [], |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
44 _('do not display revision or any of its ancestors'), _('REV')), |
365bb0fa73a4
graphlog: add all log options to glog command
Patrick Mezard <patrick@mezard.eu>
parents:
16431
diff
changeset
|
45 ] + commands.logopts + commands.walkopts, |
21782
404eca1ce4f9
graphlog: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
20118
diff
changeset
|
46 _('[OPTION]... [FILE]'), |
404eca1ce4f9
graphlog: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
20118
diff
changeset
|
47 inferrepo=True) |
14043
1c1e1232abdc
graphlog: make use of graphmod's revset support
Alexander Solovyov <alexander@solovyov.net>
parents:
14042
diff
changeset
|
48 def graphlog(ui, repo, *pats, **opts): |
7325
f9985108d4e4
graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
7324
diff
changeset
|
49 """show revision history alongside an ASCII revision graph |
f9985108d4e4
graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
7324
diff
changeset
|
50 |
9259
19a4b8fd5c48
graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9198
diff
changeset
|
51 Print a revision history alongside a revision graph drawn with |
19a4b8fd5c48
graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9198
diff
changeset
|
52 ASCII characters. |
7325
f9985108d4e4
graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
7324
diff
changeset
|
53 |
9259
19a4b8fd5c48
graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9198
diff
changeset
|
54 Nodes printed as an @ character are parents of the working |
19a4b8fd5c48
graphlog: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9198
diff
changeset
|
55 directory. |
7325
f9985108d4e4
graphlog: split the actual DAG grapher out into a separate method
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
7324
diff
changeset
|
56 """ |
17181
6f71167292f2
log: support --graph without graphlog extension
Patrick Mezard <patrick@mezard.eu>
parents:
17180
diff
changeset
|
57 return cmdutil.graphlog(ui, repo, *pats, **opts) |