[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 99a0cf7 36/92: Started work for identifying parents in nod
From: |
Alexey Veretennikov |
Subject: |
[elpa] master 99a0cf7 36/92: Started work for identifying parents in nodes |
Date: |
Thu, 11 Jun 2015 19:48:01 +0000 |
branch: master
commit 99a0cf761c155e4a01473fa7843db4cc98a74c73
Author: Alexey Veretennikov <address@hidden>
Commit: Alexey Veretennikov <address@hidden>
Started work for identifying parents in nodes
---
ztree-diff-model.el | 35 ++++++++++++++++++++++++++---------
1 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/ztree-diff-model.el b/ztree-diff-model.el
index 796302b..4d79ac9 100644
--- a/ztree-diff-model.el
+++ b/ztree-diff-model.el
@@ -11,6 +11,8 @@
(setq node (plist-put node 'children children))
(setq node (plist-put node 'different different))))
+;; Getters
+
(defun ztree-diff-model-get-left-path (node)
(plist-get node 'left))
@@ -26,6 +28,18 @@
(defun ztree-diff-model-differet (node)
(plist-get node 'different))
+;; Setters
+
+(defun ztree-diff-model-set-parent (node)
+ (plist-put node 'parent parent))
+
+(defun ztree-diff-model-set-children (node children)
+ (plist-put node 'children children))
+
+(defun ztree-diff-model-set-different (node different)
+ (plist-put node 'different different))
+
+
(defun ztree-diff-model-is-directory (node)
(let ((left (plist-get node 'left))
(right (plist-get node 'right)))
@@ -83,7 +97,7 @@
old)
old))
-(defun ztree-diff-model-traverse (path1 path2)
+(defun ztree-diff-model-traverse (parent path1 path2)
"Function traversing 2 paths returning the list where the
first element is the difference status (nil, 'diff, 'new') and
the rest is the combined list of nodes"
@@ -120,7 +134,7 @@ the rest is the combined list of nodes"
(setq different (if (ztree-diff-model-files-equal file1 file2)
nil 'diff))
;; 3.2 if it is the directory
;; 3.2.1 get the result of the directories comparison together
with status
- (let ((traverse (ztree-diff-model-traverse file1 file2)))
+ (let ((traverse (ztree-diff-model-traverse parent file1 file2)))
;; 3.2.2 update the difference status for whole comparison from
;; difference result from the 2 subdirectories comparison
(setq different (car traverse))
@@ -128,9 +142,9 @@ the rest is the combined list of nodes"
(setq children (cdr traverse)))))
;; 2.3 update difference status for the whole comparison
(setq different-dir (ztree-diff-model-update-diff different-dir
different))
- ;; push the created node to the result list
- (push (ztree-diff-model-create-node file1 file2 simple-name children
different)
- result)))
+ (let ((node (ztree-diff-model-create-node file1 file2 simple-name
children different)))
+ ;; push the created node to the result list
+ (push node result))))
;; second - adding entries from the right directory which are not present
;; in the left directory
(dolist (file2 list2)
@@ -163,14 +177,17 @@ the rest is the combined list of nodes"
(when (not (file-directory-p dir2))
(error "Path %s is not a directory" dir2))
(message (concat "Comparing " dir1 " and " dir2 " ..."))
- (let* ((traverse (ztree-diff-model-traverse dir1 dir2))
- (model
+ (let* ((model
(ztree-diff-model-create-node dir1 dir2
(concat (file-short-name dir1)
" <--> "
(file-short-name dir2))
- (cdr traverse)
- (car traverse))))
+ nil
+ nil))
+ (traverse (ztree-diff-model-traverse model dir1 dir2)))
+ (ztree-diff-model-set-children model (cdr traverse))
+ (print model)
+ (ztree-diff-model-set-different model (car traverse))
(message "Done.")
model))
- [elpa] master 41ab149 29/92: Added sorting to the tree, (continued)
- [elpa] master 41ab149 29/92: Added sorting to the tree, Alexey Veretennikov, 2015/06/11
- [elpa] master d0e255e 20/92: Implemented difftree model, Alexey Veretennikov, 2015/06/11
- [elpa] master a39e8c6 24/92: Started preparation for 2 column tree, Alexey Veretennikov, 2015/06/11
- [elpa] master 3260487 25/92: Preparing for the double tree drawing, Alexey Veretennikov, 2015/06/11
- [elpa] master 8685235 27/92: Added support for 2 trees, Alexey Veretennikov, 2015/06/11
- [elpa] master 28fa370 33/92: Reimplemented search for node by line using hash table, Alexey Veretennikov, 2015/06/11
- [elpa] master 413cff4 30/92: Drawing trees only to visible items, Alexey Veretennikov, 2015/06/11
- [elpa] master 161b1b3 35/92: Added messages, Alexey Veretennikov, 2015/06/11
- [elpa] master 9b91d44 31/92: Implemented colors support for different files, Alexey Veretennikov, 2015/06/11
- [elpa] master 44743c1 37/92: Added progress indication to the diff model, Alexey Veretennikov, 2015/06/11
- [elpa] master 99a0cf7 36/92: Started work for identifying parents in nodes,
Alexey Veretennikov <=
- [elpa] master 291a115 32/92: Header is now customizable, Alexey Veretennikov, 2015/06/11
- [elpa] master f9620df 34/92: Added action on modified files, Alexey Veretennikov, 2015/06/11
- [elpa] master 900c8fa 38/92: Refactored using defrecord macro, Alexey Veretennikov, 2015/06/11
- [elpa] master 6154ab8 21/92: Split view and models - for directory tree and for diff tree, Alexey Veretennikov, 2015/06/11
- [elpa] master 8335785 39/92: Added comment, Alexey Veretennikov, 2015/06/11
- [elpa] master 1ab3b48 43/92: Implemented file copying, Alexey Veretennikov, 2015/06/11
- [elpa] master af28a78 41/92: Started implementation of the copy functionality, Alexey Veretennikov, 2015/06/11
- [elpa] master 75b89a6 48/92: Fixed typo, Alexey Veretennikov, 2015/06/11
- [elpa] master 725f388 42/92: Preparation to copy implementation done, Alexey Veretennikov, 2015/06/11
- [elpa] master f78b859 47/92: Updated readme, Alexey Veretennikov, 2015/06/11