summary refs log tree commit diff stats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* ranger.__init__: set a default value for arghut2010-03-121-2/+0
|
* misc changes, make installhut2010-03-122-0/+4
|
* added copyright info to config files and test caseshut2010-03-0811-0/+165
|
* tc_colorscheme: updated testcasehut2010-02-281-1/+2
|
* tc_keyapi: updated testcasehut2010-02-251-1/+1
|
* shell_escape: added testcasehut2010-02-241-0/+7
|
* test/tc_commandlist: removed obsolete testhut2010-02-161-4/+6
|
* tc_ext: small updatehut2010-01-261-7/+10
|
* added testcase for openstructhut2010-01-261-0/+26
|
* added testcase for mount_pathhut2010-01-261-0/+25
|
* added unittest for flatten and uniquehut2010-01-261-0/+69
|
* fixed unit testshut2010-01-204-62/+82
|
* commandlist: bugfixhut2010-01-141-5/+6
|
* commandlist: aliases are now references rather than copieshut2010-01-131-2/+13
|
* commandlist: added alias(existing, *new)hut2010-01-131-0/+8
|
* commandlist: added clear()hut2010-01-131-0/+9
|
* fsobject.directory: removed __getitem__ (too ambiguous)hut2010-01-131-2/+0
|
* commandlist: improvements and test casehut2010-01-131-0/+54
|
* random cleanups and fixeshut2010-01-071-0/+1
|
* bookmarks: added testcase, documentation, settinghut2010-01-011-0/+73
|
* fixed tc_displayablehut2009-12-311-9/+11
|
* added documentation, clean uphut2009-12-312-7/+7
|
* removed test/stuff directoryhut2009-12-306-236/+0
| | | | It contained non-relevant scripts
* fixed a few things~hut2009-12-301-11/+0
|
* updated testhut2009-12-291-2/+2
|
* test case for keyapi.Wrapperhut2009-12-271-0/+24
|
* fixed colorschemes, added unittest for colorschemeshut2009-12-171-0/+31
|
* extended history by a couple of methodshut2009-12-171-7/+10
|
* fixed directory testhut2009-12-141-0/+3
|
* updated / added testshut2009-12-135-4/+213
|
* clean ups, commentshut2009-12-132-5/+8
|
* clean upshut2009-12-113-8/+5
|
* run all tests with a single executablehut2009-12-111-0/+5
|
* Reorganization of gui/widget hierarchy and directory structurehut2009-12-111-1/+1
|
* restructurationshut2009-12-111-2/+2
|
* moved/fixed testshut2009-12-117-1/+209
|
* fixed directory testhut2009-12-061-19/+0
|
* History Object + Test Casehut2009-12-051-0/+44
|
* random improvementshut2009-11-291-17/+18
|
* more VROOMhut2009-11-272-12/+22
|
* implemented more stuffhut2009-11-252-9/+10
|
* corrected test, added some stuffhut2009-11-242-5/+50
|
* stuffhut2009-11-241-1/+2
|
* better implementation of directories/fileshut2009-11-243-25/+54
|
* test cases for directory.pyhut2009-11-233-0/+68
>with-temp-buffer (process-file vc-git-program nil t nil "log" "--name-only" "--format=%x00%H") (let* ((commits (split-string (buffer-string) "\0" t)) (replay-count 0) (progress-reporter (make-progress-reporter "Building commit-file graph..." 0 (length commits)))) (dolist (commit commits) (let* ((sha-and-paths (split-string commit "\n\n" t (rx whitespace))) (sha (car sha-and-paths)) (paths (when (cadr sha-and-paths) (split-string (cadr sha-and-paths) "\n" t (rx whitespace))))) (git-related--record-commit graph sha paths) (progress-reporter-update progress-reporter (cl-incf replay-count)))) (progress-reporter-done progress-reporter))) graph)) (defun git-related--similar-files (graph filename) "Return files in GRAPH that are similar to FILENAME." (unless (git-related--graph-p graph) (user-error "You need to index this project first")) (let ((file (gethash filename (git-related--graph-files graph)))) (when file (let ((file-sqrt (sqrt (length (git-related--file-commits file)))) (neighbor-sqrts (make-hash-table :test 'equal :size 100)) (hits (make-hash-table :test 'equal :size 100))) (dolist (commit (git-related--file-commits file)) (dolist (neighbor (remove file (git-related--commit-files commit))) (let ((count (cl-incf (gethash (git-related--file-name neighbor) hits 0)))) (when (= count 1) (setf (gethash (git-related--file-name neighbor) neighbor-sqrts) (sqrt (length (git-related--file-commits neighbor)))))))) (let (ranked-neighbors) (maphash (lambda (neighbor-name neighbor-sqrt) (let ((axb (* file-sqrt neighbor-sqrt)) (n (gethash neighbor-name hits))) (push (list (if (cl-plusp axb) (/ n axb) 0.0) neighbor-name) ranked-neighbors))) neighbor-sqrts) (cl-sort (cl-remove-if-not #'git-related--file-exists-p ranked-neighbors :key #'cadr) #'> :key #'car)))))) (defun git-related--file-exists-p (relative-filename) "Determine if RELATIVE-FILENAME currently exists." (file-exists-p (expand-file-name relative-filename (project-root (project-current))))) (defun git-related--propertize (hit) "Given the cons HIT return a rendered representation for completion." (propertize (concat (propertize (format "%2.2f" (car hit)) 'face 'git-related-score) " ---> " (propertize (cadr hit) 'face 'git-related-file)) 'path (cadr hit))) ;;;###autoload (defun git-related-update () "Update graph for the current project." (interactive) (let* ((default-directory (project-root (project-current))) (project-symbol (intern (project-name (project-current)))) (graph (cl-getf git-related--graphs project-symbol))) (setf (cl-getf git-related--graphs project-symbol) (git-related--replay graph)))) ;;;###autoload (defun git-related-find-file () "Find files related through commit history." (interactive) (if (buffer-file-name) (let ((default-directory (project-root (project-current)))) (find-file (let* ((selection (completing-read "Related files: " (mapcar #'git-related--propertize (git-related--similar-files (cl-getf git-related--graphs (intern (project-name (project-current)))) (file-relative-name (buffer-file-name) (project-root (project-current))))) nil t))) (when selection (let ((filename (get-text-property 0 'path selection))) (find-file filename)))))) (message "Current buffer has no file"))) (provide 'git-related) ;;; git-related.el ends here