Commits

evhan  committed 0b28e63

Remote and refspec creation

  • Participants
  • Parent commits b0a3244

Comments (0)

Files changed (4)

File git-exports.scm

  create-commit
  create-note
  create-reference
+ create-remote
  create-repository
  create-tag
  create-tree
  refspec-destination
  refspec-direction
  refspec-force
+ refspec-force?
  refspec-source
  refspec-string
  refspec?
  remote-pushurl
  remote-pushurl-set!
  remote-refspecs
+ remote-refspec-add!
  remote-repository
  remote-stats
  remote-update-fetchhead-set!

File git-lolevel-exports.scm

  refspec-force
  refspec-src
  refspec-string
+ remote-add-fetch
+ remote-add-push
+ remote-clear-refspecs
  remote-connect
  remote-connected
+ remote-create
  remote-disconnect
  remote-download
  remote-free
  remote-name
  remote-pushurl
  remote-rename
+ remote-refspec-count
  remote-save
  remote-set-pushurl
  remote-set-url

File git-lolevel.scm

   ((struct oid) loid  remote-head-local-id)
   (c-string     name  remote-head-name))
 
+(define remote-add-fetch            (foreign-lambda/retval git_remote_add_fetch remote nonnull-c-string))
+(define remote-add-push             (foreign-lambda/retval git_remote_add_push remote nonnull-c-string))
 (define remote-list                 (foreign-lambda/allocate strarray git_remote_list repository))
 (define remote-get-push-refspecs    (foreign-lambda/allocate strarray git_remote_get_push_refspecs remote))
 (define remote-get-fetch-refspecs   (foreign-lambda/allocate strarray git_remote_get_fetch_refspecs remote))
 ;;;
 
 (define-git-record-type remote
-  ((remote repository) name url pushurl connect connected disconnect update-tips update-fetchhead stop save)
+  ((remote repository) clear-refspecs connected disconnect fetch name pushurl refspec-count stop save update-fetchhead update-tips url)
   (format "#<remote ~S (~a)>"
           (remote-name remote)
           (if (remote-connected? remote) "connected" "disconnected"))
 
 (define-git-record-type refspec
   ((refspec remote) src dst string direction force)
-  (format "#<refspec ~S ~S>" (refspec-src refspec) (refspec-dst refspec)))
+  (format "#<refspec ~S ~S>" (refspec-source refspec) (refspec-destination refspec)))
 
 (define-git-record-type transfer-progress
   ((transfer-progress remote) total-objects indexed-objects received-objects received-bytes)
 
 (define refspec-source refspec-src)
 (define refspec-destination refspec-dst)
+(define refspec-force? refspec-force)
 
+(define remote-clear-refspecs! remote-clear-refspecs)
 (define remote-connected? remote-connected)
 (define remote-url-valid? git-remote-valid-url)
 (define remote-url-supported? git-remote-supported-url)
 (define remote-name-valid? git-remote-is-valid-name)
+(define remote-disconnect! remote-disconnect)
+(define remote-fetch! remote-fetch)
+(define remote-update-tips! remote-update-tips)
+(define remote-update-fetchhead? remote-update-fetchhead)
 
 (define remote-url-set!              (git-record-attribute-setter git-remote-set-url))
 (define remote-pushurl-set!          (git-record-attribute-setter git-remote-set-pushurl))
 (define remote-update-fetchhead-set! (git-record-attribute-setter git-remote-update-fetchhead))
 
+(define (remote-refspec-add! rem spec #!optional (direction 'fetch))
+  (case direction
+    ((fetch) (git-remote-add-fetch (remote->pointer rem) spec))
+    ((push)  (git-remote-add-push  (remote->pointer rem) spec))
+    (else    (git-error 'remote-refspec-add! "Invalid refspec direction" direction))))
+
 (define (remote-refspecs rem)
   (let lp ((i 0)
            (a '()))
 ;           (lambda ()
 ;             (remote-disconnect rem)))))))
 
+(define (create-remote repo name url)
+  (pointer->remote repo (git-remote-create (repository->pointer repo) name url)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Cloning