Michael Olson <[EMAIL PROTECTED]> writes:

> Committed revision 280 to http://mwolson.org/bzr/dvc/
>
> xgit: Implement addremove command
>   
>   * lisp/xgit.el (xgit-addremove): New command that both adds all new files
>     to the index, and removes all deleted files from the index.  This is
>     similar to hg's addremove command.

That's really cool to have it. Indeed, that should probably become
part of the unified interface, available in the DVC menu for
status/diff, ...

That said,

=== modified file 'lisp/xgit.el'
--- lisp/xgit.el        2007-09-21 11:04:28 +0000
+++ lisp/xgit.el        2007-10-04 18:19:09 +0000
@@ -117,6 +117,15 @@
   (interactive "P")
   (dvc-run-dvc-sync 'xgit (list "add" (unless arg "-n") ".")))
 
+;;;###autoload
+(defun xgit-addremove ()
+  "Add all new files to the index, and remove all deleted files from
+the index as well."
+  (interactive)
+  (let ((executable (dvc-variable 'xgit "executable")))

Could be directly xgit-executable, since you're already within xgit,
no need to do any multiplexing.

+    (shell-command (concat executable " ls-files -d -o -z | xargs -0 "
+                           executable " update-index --add --remove"))))
+

First thing: this reduces DVC's portability. AFAIK, only GNU xargs has
"-0", and I'd rather avoid relying on pipe (I never tried DVC on
windows, but I suspect this pipe can be problematic). Anyway, since
DVC still works if addremove is broken on some platform, it's still a
good prototype at least.

This:

+    (shell-command (concat executable " ls-files -d -o -z | "
+                           executable " update-index --add --remove -z 
--stdin"))))

avoids the dependancy on xargs -0, not the one on pipe.

But more important: this adds supposedly ignored files.
"gitĀ ls-filesĀ -o" shows all unversionned files, and does not use the
appropriate .gitignore. What you need is the list of files at the
bottom of "git status", and unfortunately, I don't know any other way
that parsing "git status" for that. This particular problem should be
solved in upstream git, by extending slightly "git ls-files" I think.

-- 
Matthieu

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

Reply via email to