'hg diff' writing temp files to CWD

Jens Alfke jens at mooseyard.com
Tue Sep 25 01:00:52 CDT 2007


The "hg diff" subcommand seems to use the current working directory as  
a location for temporary files. This results in [momentary] filesystem  
changes in the repository. I'm noticing this because the GUI client  
I'm writing uses OS X kernel event notifications to detect changes to  
files, so if you edit a file in your IDE or run "hg commit" from a  
shell, it can immediately detect the change, run "hg status" and  
update its display. Unfortunately, I'm getting too many of these  
notifications, because they're triggered by the temporary files  
Mercurial creates during "hg diff" operations initiated by my app.

Is this a bug? Only the "diff" subcommand seems to do this (of the  
commands that aren't intended to alter the repo.)

Here's partial output of the OS X fs_usage utility while I ran "hg  
diff templates/rss/map" in my mercurial-stable clone. Note the file  
"FULUYP" being created (but not written to) and then removed:

22:51:55  stat              /Hack/Others/mercurial-stable/.hg
22:51:55  open              /Hack/Others/mercurial-stable/.hg/hgrc
22:51:55  stat              /Hack/Others/mercurial-stable
22:51:55  lstat             /Hack/Others/mercurial-stable
22:51:55  stat              /Hack/Others/mercurial-stable/.hg
22:51:55  open              /Hack/Others/mercurial-stable/.hg/requires
22:51:55  open              /Hack/Others/mercurial-stable/.hg/hgrc
22:51:55  open              /Hack/Others/mercurial-stable/.hg/dirstate
22:51:55  open              /Hack/Others/mercurial-stable/.hg/store/ 
00changelog.i
22:51:55  open              /Hack/Others/mercurial-stable/.hg/store/ 
00manifest.i
22:51:55  open              /Hack/Others/mercurial-stable/.hg/store/ 
00changelog.d
22:51:55  open              /Hack/Others/mercurial-stable/.hg/store/ 
00manifest.d
22:51:55  open              /Hack/Others/mercurial-stable/.hg/dirstate
22:51:55  open              /Hack/Others/mercurial-stable/.hgignore
22:51:55  lstat             /Hack/Others/mercurial-stable/templates/ 
rss/map
22:51:55  open              /Hack/Others/mercurial-stable/FULUYP
22:51:55  stat              /Hack/Others/mercurial-stable/FULUYP
22:51:55  chmod             /Hack/Others/mercurial-stable/FULUYP
22:51:55  stat              /Hack/Others/mercurial-stable/FULUYP
22:51:55  unlink            /Hack/Others/mercurial-stable/FULUYP
22:51:55  lstat             /Hack/Others/mercurial-stable
22:51:55  open              /Hack/Others/mercurial-stable/.hg/store/ 
data/templates/rss/map.i
22:51:55  lstat             /Hack/Others/mercurial-stable/templates/ 
rss/map
22:51:55  open              /Hack/Others/mercurial-stable/templates/ 
rss/map

--Jens


More information about the Mercurial mailing list