all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Checking vc-state recursively under a directory
@ 2008-07-23 10:16 Nordlöw
  2008-07-23 13:03 ` Nikolaj Schumacher
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nordlöw @ 2008-07-23 10:16 UTC (permalink / raw)
  To: help-gnu-emacs

Is it somehow possible to check whether all the files under a version-
controlled directory are all up-to-date (updated)? That is like vc-
state() but recursively for a directory?

My reason for asking is that I am writing some emacs lisp snippets
that auto-update-and-rebuild() my Emacs add-ons directly from within
their vc-repositories.

Thanks in advance,
Nordlöw


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

* Re: Checking vc-state recursively under a directory
  2008-07-23 10:16 Checking vc-state recursively under a directory Nordlöw
@ 2008-07-23 13:03 ` Nikolaj Schumacher
       [not found] ` <mailman.15267.1216818264.18990.help-gnu-emacs@gnu.org>
  2008-07-25 18:59 ` Thr4wn
  2 siblings, 0 replies; 7+ messages in thread
From: Nikolaj Schumacher @ 2008-07-23 13:03 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

Nordlöw <per.nordlow@gmail.com> wrote:

> Is it somehow possible to check whether all the files under a version-
> controlled directory are all up-to-date (updated)? That is like vc-
> state() but recursively for a directory?

What do you mean?  up-to-date or updated?  up-to-date means
(not (vc-workfile-unchanged-p "file")), while updated means something like
(file-newer-than-file-p "file.elc" "file.el")

> My reason for asking is that I am writing some emacs lisp snippets
> that auto-update-and-rebuild() my Emacs add-ons directly from within
> their vc-repositories.

Maybe `byte-recompile-directory' could be of help.


regards,
Nikolaj Schumacher




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

* Re: Checking vc-state recursively under a directory
       [not found] ` <mailman.15267.1216818264.18990.help-gnu-emacs@gnu.org>
@ 2008-07-23 13:30   ` Nordlöw
  2008-07-23 14:00     ` Nikolaj Schumacher
       [not found]     ` <mailman.15274.1216821649.18990.help-gnu-emacs@gnu.org>
  2008-07-23 13:39   ` Nordlöw
  1 sibling, 2 replies; 7+ messages in thread
From: Nordlöw @ 2008-07-23 13:30 UTC (permalink / raw)
  To: help-gnu-emacs

On 23 Juli, 15:03, Nikolaj Schumacher <n_schumac...@web.de> wrote:
> Nordlöw <per.nord...@gmail.com> wrote:
> > Is it somehow possible to check whether all the files under a version-
> > controlled directory are all up-to-date (updated)? That is like vc-
> > state() but recursively for a directory?
>
> What do you mean?  up-to-date or updated?  up-to-date means
> (not (vc-workfile-unchanged-p "file")), while updated means something like
> (file-newer-than-file-p "file.elc" "file.el")

I mean like vc-state but for a whole repository, say vc-dir-state(DIR)
and should be behave something like the following (using CVS as
example):
A function that runs "cvs update" and return, say 'up-to-date, if no
file in repository was changed otherwise say 'patched.
If this function returns 'patched we know that something was changed
and we need to rebuild things...

/Nordlöw


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

* Re: Checking vc-state recursively under a directory
       [not found] ` <mailman.15267.1216818264.18990.help-gnu-emacs@gnu.org>
  2008-07-23 13:30   ` Nordlöw
@ 2008-07-23 13:39   ` Nordlöw
  1 sibling, 0 replies; 7+ messages in thread
From: Nordlöw @ 2008-07-23 13:39 UTC (permalink / raw)
  To: help-gnu-emacs

On 23 Juli, 15:03, Nikolaj Schumacher <n_schumac...@web.de> wrote:
> Nordlöw <per.nord...@gmail.com> wrote:
> > Is it somehow possible to check whether all the files under a version-
> > controlled directory are all up-to-date (updated)? That is like vc-
> > state() but recursively for a directory?
>
> What do you mean?  up-to-date or updated?  up-to-date means
> (not (vc-workfile-unchanged-p "file")), while updated means something like
> (file-newer-than-file-p "file.elc" "file.el")

I looking for a function, say vc-dir-update(DIR),  that does "cvs
update" under DIR and returns 'up-to-date if no file was changed or
'patched if some file was updated.

/Nordlöw


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

* Re: Checking vc-state recursively under a directory
  2008-07-23 13:30   ` Nordlöw
@ 2008-07-23 14:00     ` Nikolaj Schumacher
       [not found]     ` <mailman.15274.1216821649.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Nikolaj Schumacher @ 2008-07-23 14:00 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

Nordlöw <per.nordlow@gmail.com> wrote:

> On 23 Juli, 15:03, Nikolaj Schumacher <n_schumac...@web.de> wrote:
>> Nordlöw <per.nord...@gmail.com> wrote:
>> > Is it somehow possible to check whether all the files under a version-
>> > controlled directory are all up-to-date (updated)? That is like vc-
>> > state() but recursively for a directory?
>>
>> What do you mean?  up-to-date or updated?  up-to-date means
>> (not (vc-workfile-unchanged-p "file")), while updated means something like
>> (file-newer-than-file-p "file.elc" "file.el")
>
> I mean like vc-state but for a whole repository, say vc-dir-state(DIR)
> and should be behave something like the following (using CVS as
> example):
> A function that runs "cvs update" and return, say 'up-to-date, if no
> file in repository was changed otherwise say 'patched.
> If this function returns 'patched we know that something was changed
> and we need to rebuild things...

I've never used CVS, so think SVN when reading... :)

Since you don't have a revision to compare against that function would
not be idempotent, and if you called "cvs update" manually in-between,
it wouldn't catch the change, either.  That's different from what
`vc-state' does, which compares the working copy against the
checkout-out revision (like "svn status"), but doesn't check if the
repository has something newer.

So "like `vc-state'" and what you described are different.  Which one do
you want? :)

In SVN you could store the revision when doing a build, and then compare
it to HEAD when deciding whether to do a rebuild.


regards,
Nikolaj Schumacher




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

* Re: Checking vc-state recursively under a directory
  2008-07-23 10:16 Checking vc-state recursively under a directory Nordlöw
  2008-07-23 13:03 ` Nikolaj Schumacher
       [not found] ` <mailman.15267.1216818264.18990.help-gnu-emacs@gnu.org>
@ 2008-07-25 18:59 ` Thr4wn
  2 siblings, 0 replies; 7+ messages in thread
From: Thr4wn @ 2008-07-25 18:59 UTC (permalink / raw)
  To: help-gnu-emacs

On Jul 23, 6:16 am, Nordlöw <per.nord...@gmail.com> wrote:
> Is it somehow possible to check whether all the files under a version-
> controlled directory are all up-to-date (updated)? That is like vc-
> state() but recursively for a directory?
>
> My reason for asking is that I am writing some emacs lisp snippets
> that auto-update-and-rebuild() my Emacs add-ons directly from within
> their vc-repositories.
>
> Thanks in advance,
> Nordlöw

I think that 'vc-recompute-state is what you want, as it will actually
run "cvs update".

try something like the following (this currently doesn't work because
directory-files is also returning things like the CVS folder which vc-
recompute-state throws an error because it doesn't know how to handle
it):

(progn
  (let ((retval nil))
    (dolist (cur-file (directory-files dir-path t "^[^\.]") retval)
      (push  (vc-recompute-state cur-file) retval))))

hopefully that is close to what you're looking for :-)

-Thr4wn


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

* Re: Checking vc-state recursively under a directory
       [not found]     ` <mailman.15274.1216821649.18990.help-gnu-emacs@gnu.org>
@ 2008-07-28 19:31       ` Colin S. Miller
  0 siblings, 0 replies; 7+ messages in thread
From: Colin S. Miller @ 2008-07-28 19:31 UTC (permalink / raw)
  To: help-gnu-emacs

Nikolaj Schumacher wrote:
> 
> Since you don't have a revision to compare against that function would
> not be idempotent, and if you called "cvs update" manually in-between,
> it wouldn't catch the change, either.  That's different from what
> `vc-state' does, which compares the working copy against the
> checkout-out revision (like "svn status"), but doesn't check if the
> repository has something newer.
> 
In this case, the OP would want to use (nth (file-attributes filename) 5)
for all files in the directory of interest.
This gives the mtime of the file as a list, in the same format as (current-time)
except that (current-time) gives usec as well.


> 
> 
> regards,
> Nikolaj Schumacher
> 
> 


-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.


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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 10:16 Checking vc-state recursively under a directory Nordlöw
2008-07-23 13:03 ` Nikolaj Schumacher
     [not found] ` <mailman.15267.1216818264.18990.help-gnu-emacs@gnu.org>
2008-07-23 13:30   ` Nordlöw
2008-07-23 14:00     ` Nikolaj Schumacher
     [not found]     ` <mailman.15274.1216821649.18990.help-gnu-emacs@gnu.org>
2008-07-28 19:31       ` Colin S. Miller
2008-07-23 13:39   ` Nordlöw
2008-07-25 18:59 ` Thr4wn

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.