[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5232: 23.1.90; vc-hg-working-revision always gives latest revision i

From: Magnus Henoch
Subject: bug#5232: 23.1.90; vc-hg-working-revision always gives latest revision in which file changed
Date: Wed, 16 Dec 2009 17:12:30 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

When the revision currently checked out is not the latest revision that
touched the file in question, vc-hg-working-revision gives the wrong
result.  This can happen in two cases: you have checked out a non-head
revision, or the file has been changed in another branch.  Two test

/tmp $ mkdir hgtest
/tmp $ cd hgtest
/tmp/hgtest $ hg init
/tmp/hgtest $ echo foo > foo.txt
/tmp/hgtest $ hg add foo.txt
/tmp/hgtest $ hg commit -m "Added foo.txt"
/tmp/hgtest $ echo bar > foo.txt
/tmp/hgtest $ hg commit -m "Changed foo to bar"
/tmp/hgtest $ hg up -r 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

/tmp $ mkdir hgtest2
/tmp $ cd hgtest2
/tmp/hgtest2 $ hg init
/tmp/hgtest2 $ echo foo > foo.txt
/tmp/hgtest2 $ hg add foo.txt
/tmp/hgtest2 $ hg commit -m "Added foo.txt"
/tmp/hgtest2 $ hg branch bar
marked working directory as branch bar
/tmp/hgtest2 $ echo bar > foo.txt
/tmp/hgtest2 $ hg commit -m "Changed foo to bar"
/tmp/hgtest2 $ hg update -r default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
/tmp/hgtest2 $ echo frobozz > frobozz.txt
/tmp/hgtest2 $ hg add frobozz.txt 
/tmp/hgtest2 $ hg commit -m "Added frobozz.txt"
created new head

In either case, the symptoms are the same: if you open foo.txt in emacs,
the mode line says "Hg-1" instead of the expected "Hg-0", and if you hit
C-x v g, foo.txt seems to contain "bar" instead of "foo".

It's not obvious to me how to solve this properly.  The following patch
fixes the first case, but not the second.  ("hg log --follow" would be
logical, but it seems that "--follow" means something completely
different if you specify a file.)

diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index 91e9d68..484dc0e 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -209,7 +209,9 @@ If nil, use the value of `vc-diff-switches'.  If t, use no 
                        ;; Ignore all errors.
                         "hg" nil t nil
-                        "log" "-l1" (file-relative-name file)))
+                        "log" "-l1"
+                         "-r" ".:0"
+                         (file-relative-name file)))
                     ;; Some problem happened.  E.g. We can't find an `hg'
                     ;; executable.
                     (error nil)))))))

In GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.18.1)
 of 2009-12-15 on linux-b2a3
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  jabber-activity-mode: t
  jabber-mode-line-mode: t
  eldoc-mode: t
  show-paren-mode: t
  server-mode: t
  ido-everywhere: t
  icomplete-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
- n " ) <return> C-x C-f C-x <escape> <escape> <escape> 
C-x 4 b f o o <return> M-! C-g M-: <up> <return> M-! 
h g SPC i d SPC - - h e l p <return> C-h f s t r i 
p <tab> <tab> <backspace> n g <tab> <tab> C-g C-x 4 
b <return> ( s h e l l - c o m m <M-tab> - t o <M-tab> 
SPC " h g SPC i d SPC - n " ) ) C-x C-s M-! h g SPC 
C-g <Scroll_Lock> C-x C-j C-l C-x C-j C-l <help-echo> 
<help-echo> <help-echo> <down-mouse-1> <mouse-1> M-! 
h g SPC h e l p <return> <C-s-down> <next> M-! h g 
SPC h e l p SPC s e <backspace> <backspace> e <backspace> 
r e v i s i o n l s <backspace> <backspace> s <return> 
<C-s-up> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
C-M-k C-d M-m M-d C-d C-e <left> . C-x C-s C-M-x C-x 
b f o o <return> M-x r e v e r t <return> y e s <return> 
C-x b <return> C-x 4 b <return> M-! h g SPC l o g SPC 
- r SPC 0 : . <return> M-! <up> C-e <left> <right> 
<left> <left> <left> <left> C-f C-g C-g <C-s-up> <left> 
<left> <left> <backspace> " SPC " C-x C-s C-M-x <C-s-down> 
M-x r e v e r t <return> y e s <return> <C-s-up> C-x 
v = C-x b f o o <return> C-x v g <C-backspace> C-x 
4 b <return> M-x r e p o r t - e m <tab> <return>

Recent messages:

Quit [2 times]
Saving file /home/magnus/src/emacs/lisp/vc-hg.el...
Wrote /home/magnus/src/emacs/lisp/vc-hg.el
Finding changes in /home/magnus/src/emacs/lisp/vc-hg.el...done
Redisplaying annotation...done (Spanned from 0.0 to 0.0 days old)
Mark set
Annotating... done

Load-path shadows:
~/emacs/org-mode/lisp/org-html hides 
~/emacs/org-mode/lisp/org-table hides 
~/emacs/org-mode/lisp/org-bbdb hides 
~/emacs/org-mode/lisp/org-mouse hides 
~/emacs/org-mode/lisp/org-rmail hides 
~/emacs/org-mode/lisp/org-compat hides 
~/emacs/org-mode/lisp/org-latex hides 
~/emacs/org-mode/lisp/org-gnus hides 
~/emacs/org-mode/lisp/org-habit hides 
~/emacs/org-mode/lisp/org-exp hides 
~/emacs/org-mode/lisp/org-src hides 
~/emacs/org-mode/lisp/org-plot hides 
~/emacs/org-mode/lisp/org-publish hides 
~/emacs/org-mode/lisp/org-bibtex hides 
~/emacs/org-mode/lisp/org-xoxo hides 
~/emacs/org-mode/lisp/org-remember hides 
~/emacs/org-mode/lisp/org-crypt hides 
~/emacs/org-mode/lisp/org-timer hides 
~/emacs/org-mode/lisp/org-vm hides 
~/emacs/org-mode/lisp/org hides /usr/local/share/emacs/23.1.90/lisp/org/org
~/emacs/org-mode/lisp/org-mew hides 
~/emacs/org-mode/lisp/org-archive hides 
~/emacs/org-mode/lisp/org-indent hides 
~/emacs/org-mode/lisp/org-agenda hides 
~/emacs/org-mode/lisp/org-exp-blocks hides 
~/emacs/org-mode/lisp/org-id hides 
~/emacs/org-mode/lisp/org-install hides 
~/emacs/org-mode/lisp/org-datetree hides 
~/emacs/org-mode/lisp/org-clock hides 
~/emacs/org-mode/lisp/org-w3m hides 
~/emacs/org-mode/lisp/org-irc hides 
~/emacs/org-mode/lisp/org-inlinetask hides 
~/emacs/org-mode/lisp/org-mac-message hides 
~/emacs/org-mode/lisp/org-list hides 
~/emacs/org-mode/lisp/org-colview hides 
~/emacs/org-mode/lisp/org-mobile hides 
~/emacs/org-mode/lisp/org-attach hides 
~/emacs/org-mode/lisp/org-wl hides 
~/emacs/org-mode/lisp/org-info hides 
~/emacs/org-mode/lisp/org-macs hides 
~/emacs/org-mode/lisp/org-mhe hides 
~/emacs/org-mode/lisp/org-jsinfo hides 
~/emacs/org-mode/lisp/org-freemind hides 
~/emacs/org-mode/lisp/org-icalendar hides 
~/emacs/org-mode/lisp/org-feed hides 
~/emacs/org-mode/lisp/org-footnote hides 
~/emacs/org-mode/lisp/org-protocol hides 
~/emacs/org-mode/lisp/org-ascii hides 
~/emacs/org-mode/lisp/org-docbook hides 
~/emacs/org-mode/lisp/org-faces hides 
~/emacs/emms/lisp/tq hides /usr/local/share/emacs/23.1.90/lisp/emacs-lisp/tq

(shadow emacsbug diff-mode imenu vc-git jka-compr find-func pp em-unix
pcomplete em-term term ehelp electric em-script em-prompt em-ls em-hist
em-pred em-glob em-dirs em-cmpl em-basic esh-opt em-banner em-alias
esh-var esh-io esh-cmd esh-ext esh-proc esh-arg esh-groups eshell
esh-module esh-mode esh-util add-log log-view pcvs-util vc-annotate vc
vc-dispatcher vc-hg nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph
nxml-enc xmltok mule-util cal-move org-clock multi-isearch cc-mode
cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
sh-script executable tabify man cal-china lunar solar cal-dst cal-bahai
cal-islam cal-hebrew holidays hol-loaddefs diary-lib diary-loaddefs
cal-iso cal-menu calendar cal-loaddefs tramp-imap epa epg imap-hash
tramp-gw tramp-fish tramp-smb tramp-cache tramp-ftp tramp-cmds tramp
shell tramp-compat trampver descr-text help-mode view browse-url
mailalias smtpmail newcomment locate bbdb-gui flow-fill gnus-cite smiley
ansi-color gnus-async gnus-bcklg sort gnus-ml disp-table nndoc
parse-time nnfolder utf-7 utf7 auth-source nnimap imap nndraft nnmh
copyright nnml gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp
gnus-cache spam spam-stat gnus-uu yenc gnus-msg goto-addr thingatpt
sasl-digest hmac-md5 jabber-gmail jabber-keepalive jabber-bookmarks
jabber-private jabber jabber-awesome jabber-osd jabber-wmii
jabber-xmessage jabber-festival jabber-sawfish jabber-ratpoison
jabber-screen jabber-socks5 jabber-ft-server jabber-si-server
jabber-ft-client jabber-ft-common jabber-si-client jabber-si-common
jabber-feature-neg jabber-truncate jabber-time jabber-autoaway
jabber-vcard-avatars jabber-chatstates jabber-events jabber-vcard
jabber-avatar jabber-activity jabber-watch jabber-modeline
jabber-ahc-presence jabber-ahc jabber-version jabber-ourversion
jabber-muc-nick-completion hippie-exp jabber-browse jabber-search
jabber-register jabber-roster jabber-presence assoc jabber-muc
jabber-newdisco jabber-widget jabber-disco jabber-chat ewoc
jabber-history jabber-chatbuffer jabber-alert jabber-iq jabber-keymap
jabber-core jabber-sasl sasl sasl-anonymous sasl-login sasl-plain fsm
jabber-logon jabber-conn srv dns starttls tls jabber-xml xml jabber-menu
eldoc org-feed org-w3m org-wl org-vm org-rmail org-mhe org-mew org-irc
org-jsinfo org-infojs org-html org-exp org-exp-blocks org-agenda
org-info org-gnus org-bibtex org-bbdb paren server ido icomplete time
cus-start cus-load emms-playlist-sort emms-last-played emms-info-libtag
emms-lastfm emms-url emms-playing-time emms-mode-line url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-util
url-parse url-vars emms-cache emms-info-ogginfo emms-info-mp3info
emms-info later-do emms-playlist-mode emms-player-vlc
emms-player-mplayer emms-player-simple emms-source-playlist
emms-source-file dired emms-setup emms emms-compat bbdb-gnus gnus-art
mm-uu mml2015 epg-config mm-view smime dig gnus-sum nnoo gnus-group
gnus-undo nnmail mail-source format-spec gnus-start gnus-spec gnus-int
gnus-range message sendmail ecomplete mml mml-sec password-cache
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
qp ietf-drums gmm-utils mailheader canlock sha1 hex-util hashcash
gnus-win gnus gnus-ems nnheader gnus-util netrc mail-utils mm-util
mail-prsvr wid-edit bbdb-snarf mail-extr rfc822 bbdb-com warnings
mailabbrev bbdb-autoloads bbdb regexp-opt timezone patmatch erl-service
derived derl erlext epmd net-fsm erl wrangler erlang flymake compile
comint ring w3-auto edmacro kmacro remember org-remember org-datetree
org byte-opt bytecomp byte-compile org-footnote org-src org-list
org-faces org-compat org-macs easymenu time-date noutline outline
easy-mmode org-redmine cl cl-19 org-install uniquify advice help-fns
advice-preload vc-p4 p4-lowlevel lfe-mode erlang-web-template tempo
erlang-start jabber-autoloads jabber-util tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]