I needed to add one more flag.  --file <filename> to update, so that I
could get the update status quickly for a single file.  The changes to
the function as below.  I had to make the corresponding changes to
vc-fossil.el as well.  I'm done for now, I have the "minimal"
frequently used functions working satisfactorily for vc mode to be
usable with fossil.

 - Venkat

+ const char *zFile;    /* Name of file to update */
  Blob fname;

...

  localFlag = find_option("local", 0,0) != 0;
+ zFile = find_option("file",0,1);
+ if (zFile != 0) {
+     file_tree_name(zFile, &fname, 1);
+ }
...
  db_finalize(&q);

+ if (zFile != 0) {
+     db_multi_exec("DELETE FROM fv WHERE fn <> %B", &fname);
+ }
+
  db_prepare(&q,
    "SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1"
  );
....
(defun vc-fossil-state  (file)
  "Fossil specific version of `vc-state'."
  (let ((state (vc-fossil-filestr file "update" "-n" "-v" "--local" "--file")))
    (setq status-word (car (split-string state)))
    (if (not status-word) nil
      (cond
       ((string= status-word "UNCHANGED") 'up-to-date)
       ((or (string= status-word "EDITED") (string= status-word "CONFLICT")
            (string= status-word "ADDED") (string= status-word "REMOVE"))
        'edited)
       ((string= status-word "UPDATE") 'needs-patch)
       ((string= status-word "MERGE") 'needs-merge)
       ((string= status-word "UNKNOWN") nil)))))



-----Original Message-----
From: Venkat Iyer <ven...@comit.com>
Sent: Sunday, November 1, 2009 15:27:37
Subject: Re: [fossil-users] Finding out whether a file needs an update in C

This was probably a stupid question.  What I really wanted to know was
- will the file change if I do a "fossil update".   I now have a 
newer version of emacs integration done.  

Much thanks to drh for the finfo changes in the tree.  My zip from
last time doesn't seem to have made it.  I'm attaching files inline.

Here are the fossil related changes:

 1. fossil finfo -b|--brief <filename> gives a brief 
     (one line per revision, and it prints revision numbers).  The revision
     numbers are checkin-numbers.
 2. fossil finfo -s|--status <filename> prints the
     edited state and the (checkin) revision numbers.
 3. fossil finfo -p|--print -r|--revision <rev> <filename>.  Prints the
     file from the specified (checkin) revision number.
 4. fossil update --local, does a local update without an autosync, even if
    autosync was turned on.
 5. fossil update -n|--nochange, goes through the update process (syncing if 
--local
    was not specified), but does not change any checked out file.  It prints
    out the actions it would do if -n was not specified
 6. fossil update -v|--verbose, prints messages to stdout for unchanged/edited 
files

The vc-fossil.el included here uses  
    fossil finfo -l -b
    fossil finfo -s
    fossil finfo -p -r 
    fossil update --local -n -v
    fossil diff -r 


first below is fossil diff of my clone, after 3.6.20 sqlite3 upgrade.
I have merged in drh's changes from this weekend. second is the
current vc-fossil.el.  There must be a better way to submit patches,
but I don't know about it yet.

If it makes sense, I'd suggest adding vc-fossil.el as a new file to
the repository.

Thanks

 - Venkat

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to