##// END OF EJS Templates
Emacs: document existing functions.
Bryan O'Sullivan -
r996:5ed56657 default
parent child Browse files
Show More
@@ -514,6 +514,8 b' Push changes G '
514 (insert (documentation 'hg-help-overview))))
514 (insert (documentation 'hg-help-overview))))
515
515
516 (defun hg-add (path)
516 (defun hg-add (path)
517 "Add PATH to the Mercurial repository on the next commit.
518 With a prefix argument, prompt for the path to add."
517 (interactive (list (hg-read-file-name " to add")))
519 (interactive (list (hg-read-file-name " to add")))
518 (let ((buf (current-buffer))
520 (let ((buf (current-buffer))
519 (update (equal buffer-file-name path)))
521 (update (equal buffer-file-name path)))
@@ -536,6 +538,11 b' Push changes G '
536 (error "not implemented"))
538 (error "not implemented"))
537
539
538 (defun hg-diff (path &optional rev1 rev2)
540 (defun hg-diff (path &optional rev1 rev2)
541 "Show the differences between REV1 and REV2 of PATH.
542 When called interactively, the default behaviour is to treat REV1 as
543 the tip revision, REV2 as the current edited version of the file, and
544 PATH as the file edited in the current buffer.
545 With a prefix argument, prompt for all of these."
539 (interactive (list (hg-read-file-name " to diff")
546 (interactive (list (hg-read-file-name " to diff")
540 (hg-read-rev " to start with")
547 (hg-read-rev " to start with")
541 (let ((rev2 (hg-read-rev " to end with" 'working-dir)))
548 (let ((rev2 (hg-read-rev " to end with" 'working-dir)))
@@ -557,6 +564,10 b' Push changes G '
557 diff))
564 diff))
558
565
559 (defun hg-forget (path)
566 (defun hg-forget (path)
567 "Lose track of PATH, which has been added, but not yet committed.
568 This will prevent the file from being incorporated into the Mercurial
569 repository on the next commit.
570 With a prefix argument, prompt for the path to forget."
560 (interactive (list (hg-read-file-name " to forget")))
571 (interactive (list (hg-read-file-name " to forget")))
561 (let ((buf (current-buffer))
572 (let ((buf (current-buffer))
562 (update (equal buffer-file-name path)))
573 (update (equal buffer-file-name path)))
@@ -575,6 +586,9 b' Push changes G '
575 (error "not implemented"))
586 (error "not implemented"))
576
587
577 (defun hg-log (path &optional rev1 rev2)
588 (defun hg-log (path &optional rev1 rev2)
589 "Display the revision history of PATH, between REV1 and REV2.
590 REV1 defaults to the initial revision, while REV2 defaults to the tip.
591 With a prefix argument, prompt for each parameter."
578 (interactive (list (hg-read-file-name " to log")
592 (interactive (list (hg-read-file-name " to log")
579 (hg-read-rev " to start with" "-1")
593 (hg-read-rev " to start with" "-1")
580 (hg-read-rev " to end with" (format "-%d" hg-log-limit))))
594 (hg-read-rev " to end with" (format "-%d" hg-log-limit))))
@@ -609,6 +623,9 b' Push changes G '
609 (message "Reverting %s...done" buffer-file-name)))
623 (message "Reverting %s...done" buffer-file-name)))
610
624
611 (defun hg-revert-buffer ()
625 (defun hg-revert-buffer ()
626 "Revert current buffer's file back to the latest committed version.
627 If the file has not changed, nothing happens. Otherwise, this
628 displays a diff and asks for confirmation before reverting."
612 (interactive)
629 (interactive)
613 (let ((vc-suppress-confirm nil)
630 (let ((vc-suppress-confirm nil)
614 (obuf (current-buffer))
631 (obuf (current-buffer))
@@ -628,6 +645,10 b' Push changes G '
628 (hg-revert-buffer-internal))))
645 (hg-revert-buffer-internal))))
629
646
630 (defun hg-root (&optional path)
647 (defun hg-root (&optional path)
648 "Return the root of the repository that contains the given path.
649 If the path is outside a repository, return nil.
650 When called interactively, the root is printed. A prefix argument
651 prompts for a path to check."
631 (interactive (list (hg-read-file-name)))
652 (interactive (list (hg-read-file-name)))
632 (let ((root (do ((prev nil dir)
653 (let ((root (do ((prev nil dir)
633 (dir (file-name-directory (or path (buffer-file-name)))
654 (dir (file-name-directory (or path (buffer-file-name)))
@@ -643,9 +664,18 b' Push changes G '
643 root))
664 root))
644
665
645 (defun hg-status (path)
666 (defun hg-status (path)
667 "Print revision control status of a file or directory.
668 With prefix argument, prompt for the path to give status for.
669 Names are displayed relative to the repository root."
646 (interactive (list (hg-read-file-name " for status" (hg-root))))
670 (interactive (list (hg-read-file-name " for status" (hg-root))))
647 (let ((root (hg-root)))
671 (let ((root (hg-root)))
648 (hg-view-output (hg-output-buffer-name)
672 (hg-view-output ((format "Mercurial: Status of %s in %s"
673 (let ((name (substring (expand-file-name path)
674 (length root))))
675 (if (> (length name) 0)
676 name
677 "*"))
678 (hg-abbrev-file-name root)))
649 (apply 'call-process (hg-binary) nil t nil
679 (apply 'call-process (hg-binary) nil t nil
650 (list "--cwd" root "status" path)))))
680 (list "--cwd" root "status" path)))))
651
681
General Comments 0
You need to be logged in to leave comments. Login now