all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* vc-find-revision-no-save?
@ 2023-01-31 11:57 John Yates
  2023-02-10 23:46 ` vc-find-revision-no-save? Dmitry Gutov
  0 siblings, 1 reply; 20+ messages in thread
From: John Yates @ 2023-01-31 11:57 UTC (permalink / raw)
  To: Dmitry Gutov, Philip Kaludercic, Stefan Monnier, Stefan Kangas,
	schwab, Juri Linkov
  Cc: Emacs developers

Towards the end of Oct 2022, each of you contributed to the above named
emacs-devel email thread.

With issue #61071 on debbugs.gnu.org, I have attempted to address some
of the points mentioned in the email thread via:

    [PATCH 1/3] Refactor and document vc-find-revision caching

I append the cover letter and commit message below.

This is my very first attempt to contribute to Emacs.  So far I have
received no feedback.  If I am doing something wrong, please let me know.

/john

== [PATCH 0/3] Cover letter ==========================================

This is a series of three bisectable (I hope :-) patches, culminating
in support of a new Emacs backup scheme:

* [PATCH 1/3] Refactor and document vc-find-revision caching
* [PATCH 2/3] Introduce VC timemachine capability
* [PATCH 3/3] Introduce vc-bos: backup on save (to an RCS file)

This Backup-On-Save scheme exploits a file system mirror scheme
introduced in the first patch.  By exploiting a little known aspect
of RCS's algorithm for locating a master file, backups are stored
completely removed from the work file (i.e. no local RCS directories)
and under exactly the same filename (i.e. no ',v' suffix or similar).

Accessing backed-ups exploits a new vc-timemachine capability,
introduced in the second patch.  Both the design and code owe much
to Peter Stiernström's original git-timemachine.el.  To sidestep any
copyright issues, Peter has graciously assigned git-timemachine.el's
copyright to the FSF.  With the submission timemachine functionality
is available in both vc-git and vc-rcs.

This backup scheme works equaly well with files already under some
VCS as well as with files that are not currently version controlled.

For me (primarily a C++ programmer) this is:
  * My first significant bit of elisp
  * My first exposure to the VC codebase
  * My first Emacs / FSF submission

I welcome all nature of feedback:
  * Code criticism
  * Violations of pertinent standards
  * Bug reports
  * Suggested improvement
  * . . .

== [PATCH 1/3] Refactor and document vc-find-revision caching ==========

Previously there existed two helper functions for vc--revision-other-window:

* vc--revision-other-window-save
* vc--revision-other-window-no-save

The expectation seems to have been that when materializing a revision is
deemed costly (slow backend? remote? ...) it should be saved.  I believe
that, even though the word 'cache' is never used, this was intended to
be a caching mechanism.  That said, the logic provided only a single
save/no-save global toggle.  Aspects of this mechanism were discussed
in this email thread:

  https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01794.html

I have tried to address some of the concerns raised therein and to
provide some clearer abstractions:

* When a revision gets saved it is deemed a cache.  Thus it is imperative
  that the cached revision be protected and adequately validated before
  being reused.

* A cached revision may be saved as a sibling of the file that triggered its
  materialization or in may be saved in a mirror directory tree rooted at
  `vc-cache-root'.  The latter choice avoids cluttering work trees with with
  historic revisions and enables caching across work trees.  `vc-cache-root'
  will also provide a location for the forthcoming vc-bos's backups.

* I have defined the concept of a revision buffer.  This is the form
  of buffer returned by vc's find-revision operation.  It is bound to
  a specific revision, it is read-only and it has a nil buffer-file-name.
  Thus it visits no saved nor cached file.  The rationale is twofold:

  - A revision is a materialization of immutable history

  - The only potential value for a revision buffer's buffer-file-name is a
    cache file which should likewise be regarded as immutable.  Futher, if
    materializing revisions is not deemed costly, even that file may not
    exist.  So, in the interest of consistency, revision buffers do not
    visit files.

========================================================================

* lisp/vc/vc.el (vc-find-revision-no-save, vc-find-revision-cache):
Rename defcustoms to be more descriptive.
(vc-find-revision, vc-find-revision-save, vc-find-revision-no-save):
Reimplement the enssence of these three function as a single
`vc-find-revision' function.  Clarify that the result is a revision
buffer, unattached to any file.  Support optional caching, either
alongside the original file or within a mirror directory structure
beneath `vc-cache-root'.



^ permalink raw reply	[flat|nested] 20+ messages in thread
* vc-find-revision-no-save?
@ 2022-10-24  0:27 John Yates
  2022-10-24  9:42 ` vc-find-revision-no-save? Dmitry Gutov
  2022-10-24 19:37 ` vc-find-revision-no-save? Juri Linkov
  0 siblings, 2 replies; 20+ messages in thread
From: John Yates @ 2022-10-24  0:27 UTC (permalink / raw)
  To: Emacs developers

(I am working on incorporating git-timemachine-like functionality into
vc.  If I should post questions such as the following in
help-gnu-emacs, just let me know.)

vc.el contains the following defcustom:

    (defcustom vc-find-revision-no-save nil
      "If non-nil, `vc-find-revision' doesn't write
the created buffer to file."
      :type 'boolean
      :version "27.1")

Notice that the default is nil.  What is the logic in allowing an
historic revision to be associated with a file?  Why is it not merely
a readonly buffer with no backing file?

Perhaps I have been too influenced by git...  My mental model is that
revisions are immutable _values_.  Is that not vc's model?



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-03-27 20:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31 11:57 vc-find-revision-no-save? John Yates
2023-02-10 23:46 ` vc-find-revision-no-save? Dmitry Gutov
2023-03-27 19:38   ` vc-find-revision-no-save? John Yates
2023-03-27 20:50   ` vc-find-revision-no-save? John Yates
  -- strict thread matches above, loose matches on Subject: below --
2022-10-24  0:27 vc-find-revision-no-save? John Yates
2022-10-24  9:42 ` vc-find-revision-no-save? Dmitry Gutov
2022-10-24 16:02   ` vc-find-revision-no-save? Philip Kaludercic
2022-10-24 17:14     ` vc-find-revision-no-save? Dmitry Gutov
2022-10-24 21:10     ` vc-find-revision-no-save? Stefan Monnier
2022-10-25  2:22       ` vc-find-revision-no-save? Eli Zaretskii
2022-10-28 21:57       ` vc-find-revision-no-save? Richard Stallman
2022-10-29  6:46         ` vc-find-revision-no-save? Philip Kaludercic
2022-10-29  7:07           ` vc-find-revision-no-save? Stefan Kangas
2022-10-29  9:18             ` vc-find-revision-no-save? Philip Kaludercic
2022-10-29  9:24           ` vc-find-revision-no-save? Andreas Schwab
2022-10-29  9:26             ` vc-find-revision-no-save? Philip Kaludercic
2022-10-29 15:14           ` vc-find-revision-no-save? Stefan Monnier
2022-10-29 15:40             ` vc-find-revision-no-save? Philip Kaludercic
2022-10-24 19:37 ` vc-find-revision-no-save? Juri Linkov
2022-10-24 20:00   ` vc-find-revision-no-save? John Yates

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.