Changeset 122


Ignore:
Timestamp:
08/24/07 04:34:10 (18 years ago)
Author:
Magnus Henoch
Message:

Add functions for managing pending patches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified cl-darcs/trunk/repo.lisp

    r110 r122  
    1 ;;; Copyright (C) 2006 Magnus Henoch
     1;;; Copyright (C) 2006, 2007 Magnus Henoch
    22;;;
    33;;; This program is free software; you can redistribute it and/or
     
    163163            (set-difference ours-list theirs-list :test #'equalp)
    164164            (set-difference theirs-list ours-list :test #'equalp))))
     165
     166(defun pending-filename (repodir)
     167  "Get the name of the file containing \"pending\" patches for REPODIR."
     168  (upath-subdir repodir '("_darcs" "patches") "pending"))
     169
     170(defun read-pending (repodir)
     171  "Read the \"pending\" patches of REPODIR."
     172  (let ((pending-file (pending-filename repodir)))
     173    (when (probe-file pending-file)
     174      (read-patch-from-file pending-file :compressed nil))))
     175
     176(defun add-to-pending (repodir patch)
     177  "Add PATCH to the list of \"pending\" patches in REPODIR."
     178  (let ((pending (read-pending repodir)))
     179    (when (null pending)
     180      (setf pending (make-instance 'composite-patch)))
     181    (setf (patches pending) (append (patches pending) (list patch)))
     182    (with-open-file (out (pending-filename repodir)
     183                         :direction :output :element-type '(unsigned-byte 8)
     184                         :if-exists :supersede)
     185      (write-patch pending out))))
Note: See TracChangeset for help on using the changeset viewer.