|
12 | 12 | import shutil |
13 | 13 | import platform |
14 | 14 | import getpass |
15 | | -import threading |
16 | 15 | import logging |
17 | 16 |
|
18 | 17 | # NOTE: Some of the unused imports might be used/imported by others. |
|
39 | 38 | __all__ = ("stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux", |
40 | 39 | "join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList", |
41 | 40 | "BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists', |
42 | | - 'RemoteProgress', 'CallableRemoteProgress', 'rmtree', 'WaitGroup', 'unbare_repo') |
| 41 | + 'RemoteProgress', 'CallableRemoteProgress', 'rmtree', 'unbare_repo') |
43 | 42 |
|
44 | 43 | #{ Utility Methods |
45 | 44 |
|
@@ -324,12 +323,12 @@ def update(self, op_code, cur_count, max_count=None, message=''): |
324 | 323 |
|
325 | 324 | You may read the contents of the current line in self._cur_line""" |
326 | 325 | pass |
327 | | - |
| 326 | + |
328 | 327 |
|
329 | 328 | class CallableRemoteProgress(RemoteProgress): |
330 | 329 | """An implementation forwarding updates to any callable""" |
331 | 330 | __slots__ = ('_callable') |
332 | | - |
| 331 | + |
333 | 332 | def __init__(self, fn): |
334 | 333 | self._callable = fn |
335 | 334 | super(CallableRemoteProgress, self).__init__() |
@@ -754,35 +753,6 @@ def iter_items(cls, repo, *args, **kwargs): |
754 | 753 | #} END classes |
755 | 754 |
|
756 | 755 |
|
757 | | -class WaitGroup(object): |
758 | | - """WaitGroup is like Go sync.WaitGroup. |
759 | | -
|
760 | | - Without all the useful corner cases. |
761 | | - By Peter Teichman, taken from https://gist.github.com/pteichman/84b92ae7cef0ab98f5a8 |
762 | | - """ |
763 | | - def __init__(self): |
764 | | - self.count = 0 |
765 | | - self.cv = threading.Condition() |
766 | | - |
767 | | - def add(self, n): |
768 | | - self.cv.acquire() |
769 | | - self.count += n |
770 | | - self.cv.release() |
771 | | - |
772 | | - def done(self): |
773 | | - self.cv.acquire() |
774 | | - self.count -= 1 |
775 | | - if self.count == 0: |
776 | | - self.cv.notify_all() |
777 | | - self.cv.release() |
778 | | - |
779 | | - def wait(self, stderr=b''): |
780 | | - self.cv.acquire() |
781 | | - while self.count > 0: |
782 | | - self.cv.wait() |
783 | | - self.cv.release() |
784 | | - |
785 | | - |
786 | 756 | class NullHandler(logging.Handler): |
787 | 757 | def emit(self, record): |
788 | 758 | pass |
|
0 commit comments