##// END OF EJS Templates
relink/progress: Adding progress for collecting stage
timeless -
r11355:9011036b default
parent child Browse files
Show More
@@ -48,7 +48,7 b' def relink(ui, repo, origin=None, **opts'
48 try:
48 try:
49 remotelock = src.lock()
49 remotelock = src.lock()
50 try:
50 try:
51 candidates = sorted(collect(src.store.path, ui))
51 candidates = sorted(collect(src, ui))
52 targets = prune(candidates, src.store.path, repo.store.path, ui)
52 targets = prune(candidates, src.store.path, repo.store.path, ui)
53 do_relink(src.store.path, repo.store.path, targets, ui)
53 do_relink(src.store.path, repo.store.path, targets, ui)
54 finally:
54 finally:
@@ -59,6 +59,18 b' def relink(ui, repo, origin=None, **opts'
59 def collect(src, ui):
59 def collect(src, ui):
60 seplen = len(os.path.sep)
60 seplen = len(os.path.sep)
61 candidates = []
61 candidates = []
62 live = len(src['tip'].manifest())
63 # Your average repository has some files which were deleted before
64 # the tip revision. We account for that by assuming that there are
65 # 3 tracked files for every 2 live files as of the tip version of
66 # the repository.
67 #
68 # mozilla-central as of 2010-06-10 had a ratio of just over 7:5.
69 total = live * 3 // 2
70 src = src.store.path
71 pos = 0
72 ui.status(_("tip has %d files, estimated total number of files: %s\n")
73 % (live, total))
62 for dirpath, dirnames, filenames in os.walk(src):
74 for dirpath, dirnames, filenames in os.walk(src):
63 relpath = dirpath[len(src) + seplen:]
75 relpath = dirpath[len(src) + seplen:]
64 for filename in filenames:
76 for filename in filenames:
@@ -67,8 +79,11 b' def collect(src, ui):'
67 st = os.stat(os.path.join(dirpath, filename))
79 st = os.stat(os.path.join(dirpath, filename))
68 if not stat.S_ISREG(st.st_mode):
80 if not stat.S_ISREG(st.st_mode):
69 continue
81 continue
82 pos += 1
70 candidates.append((os.path.join(relpath, filename), st))
83 candidates.append((os.path.join(relpath, filename), st))
84 ui.progress(_('collecting'), pos, filename, _('files'), total)
71
85
86 ui.progress(_('collecting'), None)
72 ui.status(_('collected %d candidate storage files\n') % len(candidates))
87 ui.status(_('collected %d candidate storage files\n') % len(candidates))
73 return candidates
88 return candidates
74
89
@@ -12,6 +12,12 b' 2 files updated, 0 files merged, 0 files'
12 created new head
12 created new head
13 % relink
13 % relink
14 relinking .hg/store
14 relinking .hg/store
15 tip has 2 files, estimated total number of files: 3
16 collecting: 00changelog.i 1/3 files (33.33%)
17 collecting: 00manifest.i 2/3 files (66.67%)
18 collecting: dummy.i 3/3 files (100.00%)
19 collecting: b.i 4/3 files (133.33%)
20 collecting: a.i 5/3 files (166.67%)
15 collected 5 candidate storage files
21 collected 5 candidate storage files
16 not linkable: 00changelog.i
22 not linkable: 00changelog.i
17 not linkable: 00manifest.i
23 not linkable: 00manifest.i
General Comments 0
You need to be logged in to leave comments. Login now