all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [patch] vc-find-root with invert
@ 2008-07-04 17:24 Justin Bogner
  2008-07-04 18:02 ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Justin Bogner @ 2008-07-04 17:24 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

Here's a patch that fixes a bug I've noticed in vc-find-root. When 
called with `invert' equal to `t', the current implementation is 
returning `file' verbatim if a file name is given, and also if `witness' 
doesn't exist at all.

In the former case we should return the directory where witness resides, 
and in the latter, `nil'. This patch implements such behaviour.

[-- Attachment #2: findroot.diff --]
[-- Type: text/x-diff, Size: 4699 bytes --]

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ee073bc..5473538 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-04  Justin Bogner  <mail@justinbogner.com>
+
+	* vc-hooks.el (vc-find-root):
+	Find the directory when using invert, not the file itself.
+
 2008-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* vc-dir.el (vc-dir-query-replace-regexp): New function.
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 2ccbdcc..0662961 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -327,39 +327,46 @@ The function walks up the directory tree from FILE looking for WITNESS.
 If WITNESS if not found, return nil, otherwise return the root.
 Optional arg INVERT non-nil reverses the sense of the check;
 the root is the last directory for which WITNESS *is* found."
-  ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
-  ;; witnesses in /home or in /.
-  (setq file (abbreviate-file-name file))
-  (let ((root nil)
-        (prev-file file)
-        ;; `user' is not initialized outside the loop because
-        ;; `file' may not exist, so we may have to walk up part of the
-        ;; hierarchy before we find the "initial UID".
-        (user nil)
-        try)
-    (while (not (or root
-                    (null file)
-                    ;; As a heuristic, we stop looking up the hierarchy of
-                    ;; directories as soon as we find a directory belonging
-                    ;; to another user.  This should save us from looking in
-                    ;; things like /net and /afs.  This assumes that all the
-                    ;; files inside a project belong to the same user.
-                    (let ((prev-user user))
-                      (setq user (nth 2 (file-attributes file)))
-                      (and prev-user (not (equal user prev-user))))
-                    (string-match vc-ignore-dir-regexp file)))
-      (setq try (file-exists-p (expand-file-name witness file)))
-      (cond ((and invert (not try)) (setq root prev-file))
-            ((and (not invert) try) (setq root file))
-            ((equal file (setq prev-file file
-                               file (file-name-directory
-                                     (directory-file-name file))))
-             (setq file nil))))
-    ;; Handle the case where ~/WITNESS exists and the original FILE is "~".
-    ;; (This occurs, for example, when placing dotfiles under RCS.)
-    (when (and (not root) invert prev-file)
-      (setq root prev-file))
-    root))
+  (when (not (file-directory-p file))
+    (setq file (file-name-directory file)))
+  ;; In the invert case, we should return nil if WITNESS doesn't exist
+  ;; in the first place.
+  (if (and invert
+           (not (file-exists-p (expand-file-name witness file))))
+      nil
+    ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
+    ;; witnesses in /home or in /.
+    (setq file (abbreviate-file-name file))
+    (let ((root nil)
+          (prev-file file)
+          ;; `user' is not initialized outside the loop because
+          ;; `file' may not exist, so we may have to walk up part of the
+          ;; hierarchy before we find the "initial UID".
+          (user nil)
+          try)
+      (while (not (or root
+                      (null file)
+                      ;; As a heuristic, we stop looking up the hierarchy of
+                      ;; directories as soon as we find a directory belonging
+                      ;; to another user.  This should save us from looking in
+                      ;; things like /net and /afs.  This assumes that all the
+                      ;; files inside a project belong to the same user.
+                      (let ((prev-user user))
+                        (setq user (nth 2 (file-attributes file)))
+                        (and prev-user (not (equal user prev-user))))
+                      (string-match vc-ignore-dir-regexp file)))
+        (setq try (file-exists-p (expand-file-name witness file)))
+        (cond ((and invert (not try)) (setq root prev-file))
+              ((and (not invert) try) (setq root file))
+              ((equal file (setq prev-file file
+                                 file (file-name-directory
+                                       (directory-file-name file))))
+               (setq file nil))))
+      ;; Handle the case where ~/WITNESS exists and the original FILE is "~".
+      ;; (This occurs, for example, when placing dotfiles under RCS.)
+      (when (and (not root) invert prev-file)
+        (setq root prev-file))
+      root)))
 
 ;; Access functions to file properties
 ;; (Properties should be _set_ using vc-file-setprop, but

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

* [patch] vc-find-root with invert
@ 2008-07-04 17:47 Justin Bogner
  0 siblings, 0 replies; 15+ messages in thread
From: Justin Bogner @ 2008-07-04 17:47 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

Here's a patch that fixes a bug I've noticed in vc-find-root. When
called with `invert' equal to `t', the current implementation is
returning `file' verbatim if a file name is given, and also if `witness'
doesn't exist at all.

In the former case we should return the directory where witness resides,
and in the latter, `nil'. This patch implements such behaviour.


[-- Attachment #2: findroot.diff --]
[-- Type: text/x-diff, Size: 4700 bytes --]

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ee073bc..5473538 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-04  Justin Bogner  <mail@justinbogner.com>
+
+	* vc-hooks.el (vc-find-root):
+	Find the directory when using invert, not the file itself.
+
 2008-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* vc-dir.el (vc-dir-query-replace-regexp): New function.
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 2ccbdcc..0662961 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -327,39 +327,46 @@ The function walks up the directory tree from FILE looking for WITNESS.
 If WITNESS if not found, return nil, otherwise return the root.
 Optional arg INVERT non-nil reverses the sense of the check;
 the root is the last directory for which WITNESS *is* found."
-  ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
-  ;; witnesses in /home or in /.
-  (setq file (abbreviate-file-name file))
-  (let ((root nil)
-        (prev-file file)
-        ;; `user' is not initialized outside the loop because
-        ;; `file' may not exist, so we may have to walk up part of the
-        ;; hierarchy before we find the "initial UID".
-        (user nil)
-        try)
-    (while (not (or root
-                    (null file)
-                    ;; As a heuristic, we stop looking up the hierarchy of
-                    ;; directories as soon as we find a directory belonging
-                    ;; to another user.  This should save us from looking in
-                    ;; things like /net and /afs.  This assumes that all the
-                    ;; files inside a project belong to the same user.
-                    (let ((prev-user user))
-                      (setq user (nth 2 (file-attributes file)))
-                      (and prev-user (not (equal user prev-user))))
-                    (string-match vc-ignore-dir-regexp file)))
-      (setq try (file-exists-p (expand-file-name witness file)))
-      (cond ((and invert (not try)) (setq root prev-file))
-            ((and (not invert) try) (setq root file))
-            ((equal file (setq prev-file file
-                               file (file-name-directory
-                                     (directory-file-name file))))
-             (setq file nil))))
-    ;; Handle the case where ~/WITNESS exists and the original FILE is "~".
-    ;; (This occurs, for example, when placing dotfiles under RCS.)
-    (when (and (not root) invert prev-file)
-      (setq root prev-file))
-    root))
+  (when (not (file-directory-p file))
+    (setq file (file-name-directory file)))
+  ;; In the invert case, we should return nil if WITNESS doesn't exist
+  ;; in the first place.
+  (if (and invert
+           (not (file-exists-p (expand-file-name witness file))))
+      nil
+    ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
+    ;; witnesses in /home or in /.
+    (setq file (abbreviate-file-name file))
+    (let ((root nil)
+          (prev-file file)
+          ;; `user' is not initialized outside the loop because
+          ;; `file' may not exist, so we may have to walk up part of the
+          ;; hierarchy before we find the "initial UID".
+          (user nil)
+          try)
+      (while (not (or root
+                      (null file)
+                      ;; As a heuristic, we stop looking up the hierarchy of
+                      ;; directories as soon as we find a directory belonging
+                      ;; to another user.  This should save us from looking in
+                      ;; things like /net and /afs.  This assumes that all the
+                      ;; files inside a project belong to the same user.
+                      (let ((prev-user user))
+                        (setq user (nth 2 (file-attributes file)))
+                        (and prev-user (not (equal user prev-user))))
+                      (string-match vc-ignore-dir-regexp file)))
+        (setq try (file-exists-p (expand-file-name witness file)))
+        (cond ((and invert (not try)) (setq root prev-file))
+              ((and (not invert) try) (setq root file))
+              ((equal file (setq prev-file file
+                                 file (file-name-directory
+                                       (directory-file-name file))))
+               (setq file nil))))
+      ;; Handle the case where ~/WITNESS exists and the original FILE is "~".
+      ;; (This occurs, for example, when placing dotfiles under RCS.)
+      (when (and (not root) invert prev-file)
+        (setq root prev-file))
+      root)))
 
 ;; Access functions to file properties
 ;; (Properties should be _set_ using vc-file-setprop, but


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

* Re: [patch] vc-find-root with invert
  2008-07-04 17:24 [patch] vc-find-root with invert Justin Bogner
@ 2008-07-04 18:02 ` Stefan Monnier
  2008-07-04 18:06   ` Justin Bogner
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2008-07-04 18:02 UTC (permalink / raw)
  To: Justin Bogner; +Cc: emacs-devel

> Here's a patch that fixes a bug I've noticed in vc-find-root. When called
> with `invert' equal to `t', the current implementation is returning `file'
> verbatim if a file name is given, and also if `witness' doesn't exist
> at all.

Can someone remind me why we have this `invert' monster?


        Stefan




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

* Re: [patch] vc-find-root with invert
  2008-07-04 18:02 ` Stefan Monnier
@ 2008-07-04 18:06   ` Justin Bogner
  2008-07-04 19:52     ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Justin Bogner @ 2008-07-04 18:06 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier wrote:
>> Here's a patch that fixes a bug I've noticed in vc-find-root. When called
>> with `invert' equal to `t', the current implementation is returning `file'
>> verbatim if a file name is given, and also if `witness' doesn't exist
>> at all.
> 
> Can someone remind me why we have this `invert' monster?
> 
> 
>         Stefan

I believe that it's for systems like CVS, where each subdirectory under 
version control has its own CVS directory.
-- 
Justin Bogner




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

* Re: [patch] vc-find-root with invert
  2008-07-04 18:06   ` Justin Bogner
@ 2008-07-04 19:52     ` Stefan Monnier
  2008-07-05  7:21       ` tomas
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2008-07-04 19:52 UTC (permalink / raw)
  To: Justin Bogner; +Cc: emacs-devel

>>> Here's a patch that fixes a bug I've noticed in vc-find-root. When called
>>> with `invert' equal to `t', the current implementation is returning `file'
>>> verbatim if a file name is given, and also if `witness' doesn't exist
>>> at all.
>> 
>> Can someone remind me why we have this `invert' monster?

> I believe that it's for systems like CVS, where each subdirectory under
> version control has its own CVS directory.

Sorry, but that doesn't help me ;-(
Anyone has a more complete explanation?


        Stefan




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

* Re: [patch] vc-find-root with invert
  2008-07-04 19:52     ` Stefan Monnier
@ 2008-07-05  7:21       ` tomas
  2008-07-21 16:27         ` Justin Bogner
  0 siblings, 1 reply; 15+ messages in thread
From: tomas @ 2008-07-05  7:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Justin Bogner, emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Jul 04, 2008 at 03:52:48PM -0400, Stefan Monnier wrote:
> >>> Here's a patch that fixes a bug I've noticed in vc-find-root. When called

[...]

> > I believe that it's for systems like CVS, where each subdirectory under
> > version control has its own CVS directory.
> 
> Sorry, but that doesn't help me ;-(
> Anyone has a more complete explanation?

Reading the docstring, my guess would be: vc-find-root walks the dir
tree up _until_ it finds WITNESS (as an evidence for the VC tree's root
dir). Unless we have CVS or SVN or similar, where every subdir has
WITNESS, so the root would be the last up-tree directory having WITNESS.

But I might be off-by-one ;-)

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIbyD2Bcgs9XrR2kYRAoMlAJ9kLtd2W2uaZrjCHSiRNUZPxy9XRgCcDtYh
WIccVoYI/fT5wTr32KYunBs=
=3xNV
-----END PGP SIGNATURE-----




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

* Re: [patch] vc-find-root with invert
  2008-07-05  7:21       ` tomas
@ 2008-07-21 16:27         ` Justin Bogner
  2008-07-21 18:32           ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Justin Bogner @ 2008-07-21 16:27 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]

tomas@tuxteam.de wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Fri, Jul 04, 2008 at 03:52:48PM -0400, Stefan Monnier wrote:
>>>>> Here's a patch that fixes a bug I've noticed in vc-find-root. When called
>
> [...]
>
>>> I believe that it's for systems like CVS, where each subdirectory under
>>> version control has its own CVS directory.
>> Sorry, but that doesn't help me ;-(
>> Anyone has a more complete explanation?
>
> Reading the docstring, my guess would be: vc-find-root walks the dir
> tree up _until_ it finds WITNESS (as an evidence for the VC tree's root
> dir). Unless we have CVS or SVN or similar, where every subdir has
> WITNESS, so the root would be the last up-tree directory having WITNESS.
>
> But I might be off-by-one ;-)
>
> Regards
> - -- tomás
>

This is exactly correct, though in the current trunk there is a bug
such that the function does not behave like this. The patch causes it
to work as documented.

The changes are actually quite small, to demonstrate, the same patch
ignoring whitespace is attached, though the original should be applied
so that the indentation is correct.

[-- Attachment #2: findroot-ignorews.patch --]
[-- Type: text/x-diff, Size: 1723 bytes --]

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cf0472e..aebc149 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -384,6 +384,11 @@
 	* textmodes/sgml-mode.el (sgml-font-lock-syntactic-keywords):
 	Use syntax-ppss on a position *before* the char we want to change.
 
+2008-07-04  Justin Bogner  <mail@justinbogner.com>
+
+	* vc-hooks.el (vc-find-root):
+	Find the directory when using invert, not the file itself.
+
 2008-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* vc-dir.el (vc-dir-query-replace-regexp): New function.
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 2ccbdcc..0662961 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -327,6 +327,13 @@ The function walks up the directory tree from FILE looking for WITNESS.
 If WITNESS if not found, return nil, otherwise return the root.
 Optional arg INVERT non-nil reverses the sense of the check;
 the root is the last directory for which WITNESS *is* found."
+  (when (not (file-directory-p file))
+    (setq file (file-name-directory file)))
+  ;; In the invert case, we should return nil if WITNESS doesn't exist
+  ;; in the first place.
+  (if (and invert
+           (not (file-exists-p (expand-file-name witness file))))
+      nil
   ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
   ;; witnesses in /home or in /.
   (setq file (abbreviate-file-name file))
@@ -359,7 +366,7 @@ the root is the last directory for which WITNESS *is* found."
     ;; (This occurs, for example, when placing dotfiles under RCS.)
     (when (and (not root) invert prev-file)
       (setq root prev-file))
-    root))
+      root)))
 
 ;; Access functions to file properties
 ;; (Properties should be _set_ using vc-file-setprop, but

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

* Re: [patch] vc-find-root with invert
  2008-07-21 16:27         ` Justin Bogner
@ 2008-07-21 18:32           ` Stefan Monnier
  2008-07-21 21:33             ` Justin Bogner
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2008-07-21 18:32 UTC (permalink / raw)
  To: Justin Bogner; +Cc: emacs-devel

>> Reading the docstring, my guess would be: vc-find-root walks the dir
>> tree up _until_ it finds WITNESS (as an evidence for the VC tree's root
>> dir). Unless we have CVS or SVN or similar, where every subdir has
>> WITNESS, so the root would be the last up-tree directory having WITNESS.

That still doesn't tell me what it does.  I mean I can read the code and
understand what is the effect of calling the code like this, but I have
no idea what effect it has for the user.  AFAICT it's a misfeature.

> This is exactly correct, though in the current trunk there is a bug
> such that the function does not behave like this. The patch causes it
> to work as documented.

I think we should remove this misfeature rather than fix it.


        Stefan




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

* Re: [patch] vc-find-root with invert
  2008-07-21 18:32           ` Stefan Monnier
@ 2008-07-21 21:33             ` Justin Bogner
  2008-07-21 22:00               ` David Kastrup
  2008-07-22  2:56               ` Stefan Monnier
  0 siblings, 2 replies; 15+ messages in thread
From: Justin Bogner @ 2008-07-21 21:33 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier wrote:
>>> Reading the docstring, my guess would be: vc-find-root walks the dir
>>> tree up _until_ it finds WITNESS (as an evidence for the VC tree's root
>>> dir). Unless we have CVS or SVN or similar, where every subdir has
>>> WITNESS, so the root would be the last up-tree directory having WITNESS.
>
> That still doesn't tell me what it does.  I mean I can read the code and
> understand what is the effect of calling the code like this, but I have
> no idea what effect it has for the user.  AFAICT it's a misfeature.
>
>> This is exactly correct, though in the current trunk there is a bug
>> such that the function does not behave like this. The patch causes it
>> to work as documented.
>
> I think we should remove this misfeature rather than fix it.
>
>
>         Stefan
>

There are two types of version control directory, ones with a "root"
directory in each directory under version control, and on with a
"root" directory in the root of the version control. Since this
function's purpose is to find the actual root of the tree, the latter
case is simple, where it needs only find the "root" directory.

However, for the other case, we need traverse upwards until we don't
find the directory, returning the last one that does. As it stands, if
we don't find the directory we look, we return wherever we started
searching, which is incorrect.

As far as getting rid of invert, we could do that, and the function
would then return something more reasonable than it does now, but it
wouldn't actually find the root unless you happened to try the root
first. Even so, this would make it work slightly better in some cases
(at least it would be `nil' when it should be). It would also consider
subdirectories that weren't in CVS to be part of CVS, which is probably
wrong, but possibly not common (I don't know about this).

I'm not convinced that `invert' is a misfeature, as it is certainly a
good intention. However, if you are convinced that it's not useful,
then I can come up with a patch that removes it, since I would prefer
not having it to having a broken version as it is now.




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

* Re: [patch] vc-find-root with invert
  2008-07-21 21:33             ` Justin Bogner
@ 2008-07-21 22:00               ` David Kastrup
  2008-07-21 22:23                 ` Justin Bogner
  2008-07-22  2:56               ` Stefan Monnier
  1 sibling, 1 reply; 15+ messages in thread
From: David Kastrup @ 2008-07-21 22:00 UTC (permalink / raw)
  To: Justin Bogner; +Cc: emacs-devel

Justin Bogner <mail@justinbogner.com> writes:

> Stefan Monnier wrote:
>>>> Reading the docstring, my guess would be: vc-find-root walks the dir
>>>> tree up _until_ it finds WITNESS (as an evidence for the VC tree's root
>>>> dir). Unless we have CVS or SVN or similar, where every subdir has
>>>> WITNESS, so the root would be the last up-tree directory having WITNESS.
>>
>> That still doesn't tell me what it does.  I mean I can read the code and
>> understand what is the effect of calling the code like this, but I have
>> no idea what effect it has for the user.  AFAICT it's a misfeature.
>>
>>> This is exactly correct, though in the current trunk there is a bug
>>> such that the function does not behave like this. The patch causes it
>>> to work as documented.
>>
>> I think we should remove this misfeature rather than fix it.
>
> There are two types of version control directory, ones with a "root"
> directory in each directory under version control, and on with a
> "root" directory in the root of the version control. Since this
> function's purpose is to find the actual root of the tree, the latter
> case is simple, where it needs only find the "root" directory.
>
> However, for the other case, we need traverse upwards until we don't
> find the directory, returning the last one that does.

Why?  CVS or SVN do not do this either.  Subdirectories with .svn in
them are self-contained work directories with associated repository
location.

> As far as getting rid of invert, we could do that, and the function
> would then return something more reasonable than it does now, but it
> wouldn't actually find the root unless you happened to try the root
> first.

There is no dedicated root in CVS or SVN.  You never need to look at
.. in order to do local operations.  You can move your directory out to
a different location under a different "root" and things will work just
the same from there.

Which is pretty much the principal reason for every directory having its
own CVS or .svn subdirectories.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




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

* Re: [patch] vc-find-root with invert
  2008-07-21 22:00               ` David Kastrup
@ 2008-07-21 22:23                 ` Justin Bogner
  2008-07-21 23:02                   ` David Kastrup
  0 siblings, 1 reply; 15+ messages in thread
From: Justin Bogner @ 2008-07-21 22:23 UTC (permalink / raw)
  Cc: emacs-devel

David Kastrup wrote:
> Justin Bogner <mail@justinbogner.com> writes:
>> However, for the other case, we need traverse upwards until we don't
>> find the directory, returning the last one that does.
> 
> Why?  CVS or SVN do not do this either.  Subdirectories with .svn in
> them are self-contained work directories with associated repository
> location.
> 
>> As far as getting rid of invert, we could do that, and the function
>> would then return something more reasonable than it does now, but it
>> wouldn't actually find the root unless you happened to try the root
>> first.
> 
> There is no dedicated root in CVS or SVN.  You never need to look at
> .. in order to do local operations.  You can move your directory out to
> a different location under a different "root" and things will work just
> the same from there.
> 
> Which is pretty much the principal reason for every directory having its
> own CVS or .svn subdirectories.
> 

Is this still true if you need to do nonlocal operations? If so then this is
indeed a misfeature.

ps: sent to David and forgot to CC emacs-devel, sorry.




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

* Re: [patch] vc-find-root with invert
  2008-07-21 22:23                 ` Justin Bogner
@ 2008-07-21 23:02                   ` David Kastrup
  2008-07-23  4:35                     ` Justin Bogner
  0 siblings, 1 reply; 15+ messages in thread
From: David Kastrup @ 2008-07-21 23:02 UTC (permalink / raw)
  To: Justin Bogner; +Cc: emacs-devel

Justin Bogner <mail@justinbogner.com> writes:

> David Kastrup wrote:
>> Justin Bogner <mail@justinbogner.com> writes:
>>> However, for the other case, we need traverse upwards until we don't
>>> find the directory, returning the last one that does.
>>
>> Why?  CVS or SVN do not do this either.  Subdirectories with .svn in
>> them are self-contained work directories with associated repository
>> location.
>>
>>> As far as getting rid of invert, we could do that, and the function
>>> would then return something more reasonable than it does now, but it
>>> wouldn't actually find the root unless you happened to try the root
>>> first.
>>
>> There is no dedicated root in CVS or SVN.  You never need to look at
>> .. in order to do local operations.  You can move your directory out to
>> a different location under a different "root" and things will work just
>> the same from there.
>>
>> Which is pretty much the principal reason for every directory having its
>> own CVS or .svn subdirectories.
>>
>
> Is this still true if you need to do nonlocal operations?

With "local" I meant "local to the current tree location" whether in the
work directory or repository, not "local to this computer".

> If so then this is indeed a misfeature.

The only sort of justification I could imagine is when you are trying to
create a patch and/or work with a file set.  Then you want to have some
sort of common root.  However, just walking upwards is not guaranteed to
give you such a root: it is perfectly feasible to place some directory
under CVS for backup purposes, but have a non-registered subdirectory
_also_ under CVS with a completely different repository.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




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

* Re: [patch] vc-find-root with invert
  2008-07-21 21:33             ` Justin Bogner
  2008-07-21 22:00               ` David Kastrup
@ 2008-07-22  2:56               ` Stefan Monnier
  1 sibling, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2008-07-22  2:56 UTC (permalink / raw)
  To: Justin Bogner; +Cc: emacs-devel

> However, for the other case, we need traverse upwards until we don't
> find the directory, returning the last one that does. As it stands, if
> we don't find the directory we look, we return wherever we started
> searching, which is incorrect.

It's not incorrect at all.  It's how CVS and Svn work.  They don't have
a "root directory".  you may have /foo/baqr/CVS and /foo/CVS, but it
doesn't mean /foo is the root: the two may be simply unrelated.

I.e. it's tryuing to invent something that's simply not there.  No other
CVS or Svn front-end does that as far I know.  The user specifies the
root he wants to use when it starts vc-dir: Emacs doesn't need to
guess it.

I.e. VC's "root dir" is not something for the UI but something for
internal use, fpor those backends that need it (and indeed, it didn't
exist when VC only supported CVS, RCS, and SCCS).


        Stefan




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

* Re: [patch] vc-find-root with invert
  2008-07-21 23:02                   ` David Kastrup
@ 2008-07-23  4:35                     ` Justin Bogner
  2008-07-23 19:35                       ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Justin Bogner @ 2008-07-23  4:35 UTC (permalink / raw)
  To: emacs-devel

David Kastrup wrote:
> The only sort of justification I could imagine is when you are trying to
> create a patch and/or work with a file set.  Then you want to have some
> sort of common root.  However, just walking upwards is not guaranteed to
> give you such a root: it is perfectly feasible to place some directory
> under CVS for backup purposes, but have a non-registered subdirectory
> _also_ under CVS with a completely different repository.
> 

This is a very valid point, and given Stefan's argument that these 
version control systems don't have such concepts, I am somewhat 
dismayed. The concept of a root directory of a project is extremely 
useful for things like recursive grep, tags, etc. I find it quite 
helpful to set the default-directory to the vc root in such circumstances.

Oh well, given the arguments, I vote that this is a misfeature and 
should be removed.





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

* Re: [patch] vc-find-root with invert
  2008-07-23  4:35                     ` Justin Bogner
@ 2008-07-23 19:35                       ` Stefan Monnier
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2008-07-23 19:35 UTC (permalink / raw)
  To: Justin Bogner; +Cc: emacs-devel

> This is a very valid point, and given Stefan's argument that these version
> control systems don't have such concepts, I am somewhat dismayed. The
> concept of a root directory of a project is extremely useful for things like
> recursive grep, tags, etc. I find it quite helpful to set the
> default-directory to the vc root in such circumstances.

I agree it's useful.  But there's no reason why this should be
implicitly inferred/guessed from the structure of the revision control
info.  Even with VCS such as Bazaar or Git, you can have a single
project decomposed into several checkouts of various Bazaar and/or Git
subprojects (in Arch, this was supported explicitly (tho poorly) via the
notion of "config").

> Oh well, given the arguments, I vote that this is a misfeature and should
> be removed.

I'm glad we agree.


        Stefan




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

end of thread, other threads:[~2008-07-23 19:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-04 17:24 [patch] vc-find-root with invert Justin Bogner
2008-07-04 18:02 ` Stefan Monnier
2008-07-04 18:06   ` Justin Bogner
2008-07-04 19:52     ` Stefan Monnier
2008-07-05  7:21       ` tomas
2008-07-21 16:27         ` Justin Bogner
2008-07-21 18:32           ` Stefan Monnier
2008-07-21 21:33             ` Justin Bogner
2008-07-21 22:00               ` David Kastrup
2008-07-21 22:23                 ` Justin Bogner
2008-07-21 23:02                   ` David Kastrup
2008-07-23  4:35                     ` Justin Bogner
2008-07-23 19:35                       ` Stefan Monnier
2008-07-22  2:56               ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2008-07-04 17:47 Justin Bogner

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.