Offer to migrate from timeclock-file
This commit is contained in:
parent
d6b4f65783
commit
d10631b0f9
|
@ -84,6 +84,16 @@ See `timeclock-log-data' for a description."
|
|||
chronometrist-migrate-table)
|
||||
(save-buffer)))))
|
||||
|
||||
(defun chronometrist-migrate-check ()
|
||||
"Offer to import data from `timeclock-file' if `chronometrist-file' does not exist."
|
||||
(when (and (bound-and-true-p timeclock-file)
|
||||
(not (file-exists-p chronometrist-file)))
|
||||
(if (yes-or-no-p (format (concat "Chronometrist v0.3 uses a new file format;"
|
||||
" import data from %s ? ")
|
||||
timeclock-file))
|
||||
(chronometrist-migrate-timelog-file->sexp-file timeclock-file chronometrist-file)
|
||||
(message "You can migrate later using `chronometrist-migrate-timelog-file->sexp-file'."))))
|
||||
|
||||
(provide 'chronometrist-migrate)
|
||||
|
||||
;;; chronometrist-migrate.el ends here
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
(require 'chronometrist-common)
|
||||
(require 'chronometrist-timer)
|
||||
(require 'chronometrist-report-custom)
|
||||
(require 'chronometrist-migrate)
|
||||
|
||||
;; TODO - improve first-run (no file, or no data in file) behaviour
|
||||
|
||||
|
@ -251,6 +252,7 @@ If KEEP-DATE is nil (the default when not supplied), set
|
|||
current week. Otherwise, display data from the week specified by
|
||||
`chronometrist-report--ui-date'."
|
||||
(interactive)
|
||||
(chronometrist-migrate-check)
|
||||
(let ((buffer (get-buffer-create chronometrist-report-buffer-name)))
|
||||
(with-current-buffer buffer
|
||||
(cond ((and (get-buffer-window chronometrist-report-buffer-name)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
(require 'chronometrist-timer)
|
||||
(require 'chronometrist-events)
|
||||
(require 'chronometrist-statistics-custom)
|
||||
(require 'chronometrist-migrate)
|
||||
|
||||
;; for each activity -
|
||||
;; [x] days active - int (float percent)
|
||||
|
@ -281,6 +282,7 @@ If PRESERVE-STATE is nil (the default when not supplied), display
|
|||
data from the current week. Otherwise, display data from the week
|
||||
specified by `chronometrist-statistics--ui-state'."
|
||||
(interactive)
|
||||
(chronometrist-migrate-check)
|
||||
(let* ((buffer (get-buffer-create chronometrist-statistics-buffer-name))
|
||||
(today (chronometrist-date))
|
||||
(week-start (chronometrist-report-previous-week-start today))
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
(require 'chronometrist-statistics)
|
||||
(require 'chronometrist-sexp)
|
||||
(require 'chronometrist-queries)
|
||||
(require 'chronometrist-migrate)
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
@ -401,6 +402,7 @@ Based on their timelog file `timeclock-file'. This is the
|
|||
If numeric argument ARG is 1, run `chronometrist-report'.
|
||||
If numeric argument ARG is 2, run `chronometrist-statistics'."
|
||||
(interactive "P")
|
||||
(chronometrist-migrate-check)
|
||||
(let ((buffer (get-buffer-create chronometrist-buffer-name))
|
||||
(w (get-buffer-window chronometrist-buffer-name t)))
|
||||
(cond
|
||||
|
|
Reference in New Issue
Block a user