WIP: Porting to Nim.

This commit is contained in:
Jonathan Bernard 2016-01-25 09:13:34 -06:00
parent c0e3818520
commit ab99661720
3 changed files with 29 additions and 0 deletions

@ -1,5 +1,17 @@
import os, docopt, tables, md5, iterutils, re import os, docopt, tables, md5, iterutils, re
type
FileEntry* = tuple[relPath: string, checksum: string]
DirAnalysis* = tuple[allEntries: seq[FileEntry],
byRelPath: Table[string, FileEntry],
byChecksum: Table[string, FileEntry]]
proc analyzeDir(root: string): DirAnalysis =
let fileCount = countFiles(root)
proc countFiles(root: string): int =
# TODO
proc studyDir(root: string, ignore: Iterable[string]): TableRef[string, string] = proc studyDir(root: string, ignore: Iterable[string]): TableRef[string, string] =
result = newTable[string, string]() result = newTable[string, string]()

12
treediff.pseudocode Normal file

@ -0,0 +1,12 @@
analyzeDir (tail call optimizable?)
count total # of files
for all files in directory
compute md5 checksum
create file entry: file obj, relative path, checksum
add entry to dictionary indexed by relative path
add entry to dictionary indexed by checksum
add entry to list of all entries
for each subdirectory, analyzeDir
return analysis

5
worklog.md Normal file

@ -0,0 +1,5 @@
Current Task
========================================
Currently implementing `countFiles` in
treediff.nim