;ELC   
;;; Compiled by daveg@contents-vnder-pressvre.mit.edu on Wed Dec 27 15:22:11 2006
;;; from file /afs/sipb.mit.edu/user/daveg/el/bbdb/lisp/bbdb-migrate.el
;;; in Emacs version 21.4.1
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`bbdb-migrate.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\302\303!\210\301B\304\302\207" [current-load-list bbdb-migration-features require bbdb ((3 . "* Date format for `creation-date' and `timestamp' has changed,\n  from \"dd mmm yy\" (ex: 25 Sep 97) to \"yyyy-mm-dd\" (ex: 1997-09-25)."))] 2)
#@160 Ask if the database is to be migrated.  ONDISK is the version
number of the database as currently stored on disk.  Returns the
version for the saved database.
(defalias 'bbdb-migration-query #[(ondisk) "\212\306 \307\310!\311\312\211q\210\313 \210eb\210\314\315\316\211#!\210\f\203^ \f\211@@)V\203W \314\203? \312\211\202@ \317\320\315\321\f\211@@)\"\322\f\211@A)\260!\210\fA\211\204' \323!\324\n!\210\325\326\315\321\"\327Q!\330\n!\210\331 \210\332!\210	\203\206 \202\210 .\207" [bbdb-migration-features update win first newfeatures buf current-window-configuration get-buffer-create "*BBDB Migration Info*" t nil erase-buffer insert-string format "BBDB new data version notice:\n=============================\n\nYour BBDB data is stored in an older format (version %d).  At this point,\nyou have the option of either upgrading or continuing to save your data\nin your current format.  Please note that if you elect the latter option,\nany changes made to your data using features intended for the newer\nversions will be lost.  For your convenience, a list of file format\nchanges introduced after version %d is shown below:\n\n" "\n\n" "New features in database version " "%d" ":\n\n" display-buffer shrink-window-if-larger-than-buffer y-or-n-p "Upgrade to version " "? " delete-window kill-this-buffer set-window-configuration wc ondisk x bbdb-file-format] 7 (#$ . 905)])
#@133 Migrate the BBDB from the version on disk (the car of
`bbdb-file-format-migration') to the current version (in
`bbdb-file-format').
(defalias 'bbdb-migrate #[(records) "@\304U\203# \305\211\203  \306\n\307@\310\"C\"A\211\204 \n*\207\311\312\313@\"!\207" [bbdb-file-format-migration currec newrecs records 2 nil append bbdb-migrate-record ((bbdb-record-raw-notes bbdb-record-set-raw-notes bbdb-migrate-change-dates)) error format "BBDB Cannot migrate from unknown version %d"] 6 (#$ . 2323)])
#@152 Reverse-migrate a single record from the current version (in
`bbdb-file-format') to the version to be saved (the cdr of
`bbdb-file-format-migration').
(defalias 'bbdb-unmigrate-record #[(record) "A\302U\203\f \303	\304\"\207\305\306\307@\"!\207" [bbdb-file-format-migration record 2 bbdb-migrate-record ((bbdb-record-raw-notes bbdb-record-set-raw-notes bbdb-unmigrate-change-dates)) error format "BBDB Cannot unmigrate to unknown version %d"] 4 (#$ . 2832)])
#@375 Perform changes on a single database record (passed in REC).
CHANGES is a function containing entries of the form

        (GET SET FUNCTION)

where GET is the function to be used to retrieve the field to be
modified, and SET is the function to be used te set the field to be
modified.  FUNCTION will be applied to the result of GET, and its
results will be saved with SET.
(defalias 'bbdb-migrate-record #[(rec changes) "\304\211\n\203* \305\n@@D!\305\306\n@8\301D!\305\n@A@\300E!\210\nA\211\204 *\207" [b a changes rec nil eval 2] 5 (#$ . 3300)])
#@142 Change date formats in timestamp and creation-date fields from
"dd mmm yy" to "yyyy-mm-dd".  Assumes the notes are passed in as an
argument.
(defalias 'bbdb-migrate-change-dates #[(rec) "<\203% \211\203$ 	\211@@)\303>\203 	\304	@!\240\210	A\211\204 )\207" [rec recptr x (creation-date timestamp) bbdb-migrate-change-dates-change-field] 4 (#$ . 3865)])
#@77 Migrate the date field (the cdr of FIELD) from "dd mmm yy" to
"yyyy-mm-dd".
(defalias 'bbdb-migrate-change-dates-change-field #[(field) "A\304\305\n\306P!\211\307\232\203\210 \305\n!\211\310\232\203\210 \311\312\n\"\203S \313\314\315\316\n\"!\314\315\317\n\"!\314\315\320\n\"!#\321\322@A\323\324	\316H\"@\227!	\317H	\325H&\210\202\210 \311\326\n\"\203\210 \313\314\315\320\n\"!\314\315\316\n\"!\314\315\317\n\"!#\321\322@A\323\324	\316H\"@\227!	\317H	\325H&\210	\325H;\203\230 	\325\314	\325H!I\210	\316H;\203\250 	\316\314	\316H!I\210	\317H;\203\270 	\317\314	\317H!I\210\325	\325HW\203\372 \325	\316HW\203\372 \327	\316HY\203\372 \325	\317HW\203\372 \330	\316H	\325H\"	\317HY\203\372 \331\332	\325H	\316H	\317H$\241\210\202\377 \333\334\n#*\207" [field parsed date timezone-months-assoc nil timezone-parse-date " 00:00:00" ["0" "0" "0" "0" nil] ["0" "0" "0" "0" nil] string-match "^\\([0-9]\\{4\\}\\)[-/]\\([ 0-9]?[0-9]\\)[-/]\\([ 0-9]?[0-9]\\)" vector string-to-int match-string 1 2 3 bbdb-warn "BBDB is treating %s field value %s as %s %d %d" upcase-initials rassoc 0 "^\\([ 0-9]?[0-9]\\)[-/]\\([ 0-9]?[0-9]\\)[-/]\\([0-9]\\{4\\}\\)" 12 timezone-last-day-of-month format "%04d-%02d-%02d" error "BBDB cannot parse %s header value %S for upgrade"] 8 (#$ . 4231)])
#@146 Change date formats is timestamp and creation-date fields from
"yyyy-mm-dd" to "dd mmm yy".  Assumes the notes list is passed in
as an argument.
(defalias 'bbdb-unmigrate-change-dates #[(rec) "<\203' \211\205% 	\211@@)\303>\203 	\304	@!\240\210	A\211\204 \305)\207\207" [rec recptr x (creation-date timestamp) bbdb-unmigrate-change-dates-change-field nil] 4 (#$ . 5522)])
#@80 Unmigrate the date field (the cdr of FIELD) from "yyyy-mm-dd" to
"yyyy-mm-dd".
(defalias 'bbdb-unmigrate-change-dates-change-field #[(field) "@\301A\302\"B\207" [field bbdb-time-convert "%e %b %y"] 4 (#$ . 5908)])
#@252 Rewrite each and every record in the bbdb file; this is necessary if we 
are updating an old file format.  MESSAGE-P says whether to sound off
for each record converted.  If RECORDS is non-nil, its value will be
used as the list of records to update.
(defalias 'bbdb-migrate-rewrite-all #[(message-p &optional records) "\204 \303 \304\205/ \305@\306\"\210\n\203' \307\310	T\211@\304H@\311H$\210A\211\204 \306)\207" [records i message-p bbdb-records 0 bbdb-overwrite-record-internal nil message "Updating %d: %s %s" 1] 7 (#$ . 6131)])
(defalias 'bbdb-dry-heaves 'bbdb-migrate-rewrite-all)
#@75 Change the `file-version' string from the OLD version to the NEW
version.
(defalias 'bbdb-migrate-update-file-version #[(old new) "eb\210\303\304\305\"\306\307#\203 \310\304\311	\"!\207\312\304\313\n	#!\207" [old new bbdb-file re-search-forward format "^;;; file-version: %d$" nil t replace-match ";;; file-version: %d" error "Can't find file-version string in %s buffer for v%d migration"] 5 (#$ . 6737)])
(provide 'bbdb-migrate)
