On Feb 14, 11:02 am, Sean McNeil <seanmcne...@gmail.com> wrote:
> I want to provide a difference of my repo and apply it to a clean copy.
> How is this done? The repo command doesn't appear to support an apply
> command. Is this a planned feature, is there another means to do this
> easily?


Hey Sean:

Here's a guile script that acts as a filter for repo diff output.

Yeh, I know, I should have written it in python.

g


#!/usr/bin/guile \
--debug -e main -s
!#

; Fix the repo diff output so that it can be used with patch like so:
;    repo diff | fixRepo.scm | patch -p1 -R
; comments/questions to george.jahad.andr...@blackbirdsystems.net

(define proj-marker "project ")
(define current-directory "")
(define file-marker "--- a/")


(use-modules (ice-9 rdelim))
(define (main args)
  (let loop ((x (read-line)))
    (if (not (eof-object? x))
        (begin
                                        ; Get the current directory
          (if (>= (string-length x) (string-length proj-marker))
              (if (string=? proj-marker
                            (substring x 0 (string-length proj-marker)))
                  (set! current-directory
                        (substring x (string-length proj-marker) (string-length 
x)))))

                                        ; Update the filename with the current 
directory
          (if (>= (string-length x) (string-length file-marker))
              (if (string=? file-marker
                            (substring x 0 (string-length file-marker)))
                  (set! x (string-append file-marker current-directory
                                         (substring x (string-length 
file-marker) (string-length x))))))
          (display x)
          (newline)
          (loop (read-line))))))

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to