3 bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
8 from __future__ import absolute_import, print_function
11 from bup.compat import argv_bytes
12 from bup.io import byte_stream
15 # Print the full paths of all the files in each hardlink set
16 # underneath one of the paths. Separate sets with a blank line, sort
17 # the paths within each set, and sort the sets by their first path.
20 print("Usage: hardlink-sets <paths ...>", file=sys.stderr)
30 out = byte_stream(sys.stdout)
34 for p in (argv_bytes(x) for x in sys.argv[1:]):
35 for root, dirs, files in os.walk(p, onerror = on_walk_error):
36 for filename in files:
37 full_path = os.path.join(root, filename)
38 st = os.lstat(full_path)
39 if not stat.S_ISDIR(st.st_mode):
40 node = b'%d:%d' % (st.st_dev, st.st_ino)
41 link_paths = hardlink_set.get(node)
43 link_paths.append(full_path)
45 hardlink_set[node] = [full_path]
48 for node, link_paths in hardlink_set.items():
52 for link_paths in sorted(hardlink_set.values(), key = lambda x : x[0]):
53 if len(link_paths) > 1:
58 for p in sorted(link_paths):