The dvc.experiment.fileinfo branch is now ready for review, and
possibly for merging into main.

It's at http://stephe-leake.org/dvc.experiment.fileinfo

It adds a new file lisp/dvc-fileinfo, which defines Common Lisp
structs for ewoc elements used in dvc-diff-mode.

The structs are:

(defstruct (dvc-fileinfo-file
            (:include dvc-fileinfo-root)
            (:copier nil))
  mark          ;; t/nil.
  dir           ;; Directory the file resides in, relative to dvc-root.
  file          ;; File name sans directory.
                ;; (concat dir file) gives a valid path.
  status        ;; Symbol; see dvc-fileinfo-status-image for list
  more-status   ;; String; whatever else the backend has to say
  )

(defstruct (dvc-fileinfo-dir
            (:include dvc-fileinfo-file)
            (:copier nil))
  ;; no extra slots
  )

(defstruct (dvc-fileinfo-message
            (:include dvc-fileinfo-root)
            (:copier nil))
  text ;; String
  )

(defstruct (dvc-fileinfo-legacy
            (:include dvc-fileinfo-root)
            (:copier nil))
  ;; This type is has the same form as the old dvc-diff-cookie ewoc
  ;; element. It is provided to ease the transition to the new
  ;; structure; current parsing code needs very few changes to use
  ;; this, and can be more gradually changed to use a dvc-fileinfo
  ;; struct.

  data
  ;; one of:
  ;; (file \"filename\" \"[CRADP?]\" \"M\" \"/\" \"origname\")
  ;; (subtree \"name\" related-buffer changes?)
  ;; (searching-subtree \"<message>\" )
  )

dvc-diff.el has extensive changes to use this code.

The dvc-fileinfo-legacy struct makes it easy to modify the current
back-ends to use this new code, and I have done that. However, to take
full advantage of it, they should be changed to use the file struct,
and we should possibly introduce new structs for grouping and
subtrees.

The xmtn and bzr back-ends take full advantage of these structs.

Having well-defined structs makes possible new features. One is
dvc-fileinfo-rename, which is bound to 'R' in dvc-diff-mode. The user
marks one 'unknown' file, and the correspoding 'missing' file, and
dvc-fileinfo-rename registers the rename with the back-end. This
doesn't work with bzr; it apparently doesn't support this action.

Another is dvc-diff-dtrt ("do the right thing"), bound to M-d in
dvc-diff-mode. It either performs the next appropriate action, or
offers a short list of actions depending on the current status.

--
-- Stephe

_______________________________________________
Dvc-dev mailing list
[email protected]
https://mail.gna.org/listinfo/dvc-dev

Reply via email to