When cloning a repository, pristine copying is done by the function
Darcs.Repository.Hashed.copyHashed . This function reads the "root"
hashed file of the pristine, which describes its contents as a
directory. The contents are represented as a list which contains files
and directories. Then it processes this list. In the case of a file, it
copies it. In the case of a directory, it creates it and (recursively)
calls copyHashed on this directory.
Hence directories described by the remote pristine are traversed
depth-first and files and directories processing is mixed. Moreover the
amount of files grows during the progress report of cloning.
From the UI point of view, it would be better to know ASAP the total
amount of directories and files, and proceed copying files only when
their total amount is known. Then the progress report would look a
little more informative.
This can be done by reimplementing copyHashed in a breadth first way and
maintaining directories and files in separate queues.
One caveat is that copyHashed works by changing the current directory to
the one of the directory currently copied from the remote pristine.
Files are also copied in the same "local" way since hashed pristine
files only contain file names (without their paths).
|