Mercurial > hg
annotate tests/ls-l.py @ 44909:d452acc8cce8 stable
flags: account for flag change when tracking rename relevant to merge
There are some logic filtering rename to the one relevant to the merge. That
logic was oblivious of flag change, leading to exec flag being dropped when
merged with a renamed.
There are two others bugs affecting this scenario. This patch fix the was where
there is not modification involved except for the flag change. Fixes for the
other bug are coming in later changesets.
Differential Revision: https://phab.mercurial-scm.org/D8531
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 16 May 2020 20:37:56 +0200 |
parents | 2372284d9457 |
children | c102b704edb5 |
rev | line source |
---|---|
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 # like ls -l, but do not print date, user, or non-common mode bit, to avoid |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 # using globs in tests. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 from __future__ import absolute_import, print_function |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 import os |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 import stat |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 import sys |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
40495
diff
changeset
|
11 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
12 def modestr(st): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
13 mode = st.st_mode |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 result = '' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
15 if mode & stat.S_IFDIR: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
16 result += 'd' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 result += '-' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
19 for owner in ['USR', 'GRP', 'OTH']: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 for action in ['R', 'W', 'X']: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 if mode & getattr(stat, 'S_I%s%s' % (action, owner)): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 result += action.lower() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 result += '-' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 return result |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
40495
diff
changeset
|
27 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
28 def sizestr(st): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
29 if st.st_mode & stat.S_IFREG: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
30 return '%7d' % st.st_size |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
31 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
32 # do not show size for non regular files |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
33 return ' ' * 7 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
34 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
40495
diff
changeset
|
35 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
36 os.chdir((sys.argv[1:] + ['.'])[0]) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
37 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
38 for name in sorted(os.listdir('.')): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
39 st = os.stat(name) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
40 print('%s %s %s' % (modestr(st), sizestr(st), name)) |