Mercurial > hg
annotate tests/list-tree.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 | 6000f5b25c9b |
rev | line source |
---|---|
35217
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 from __future__ import ( |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 absolute_import, |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 print_function, |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 ) |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 import argparse |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 import os |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 ap = argparse.ArgumentParser() |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 ap.add_argument('path', nargs='+') |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
11 opts = ap.parse_args() |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
12 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
35380
diff
changeset
|
13 |
35217
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 def gather(): |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
15 for p in opts.path: |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
16 if not os.path.exists(p): |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 return |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 if os.path.isdir(p): |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
19 yield p + os.path.sep |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 for dirpath, dirs, files in os.walk(p): |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 for d in dirs: |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 yield os.path.join(dirpath, d) + os.path.sep |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 for f in files: |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 yield os.path.join(dirpath, f) |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 else: |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 yield p |
aa905f9cdcda
tests: write and use a custom helper script to avoid find's -printf
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
27 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
35380
diff
changeset
|
28 |
35380
acff41957b34
tests: stabilize the sorted output of list-tree.py on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35217
diff
changeset
|
29 print('\n'.join(sorted(gather(), key=lambda x: x.replace(os.path.sep, '/')))) |