``hg cat'' does not follow copies in history. Bug?

Patrick Mézard pmezard at gmail.com
Sun Nov 18 10:44:14 UTC 2007


Brad Larsen a écrit :
> Hi list,
> 
> I ran into the following just now.  I have a repository laid out something  
> like this
> 
> foo/
> 	a b c
> foo'/
> 	a b c
> 
> where foo' and its contents are a copy of foo and contents (done using hg  
> copy).  So foo' and its contents are a different project forked off of foo  
> with no plan to ever merge them.
> 
> (This arrangement might be silly in and of itself, but the repository  
> contains a handful of very closely related projects and it's often more  
> convenient to manipulate them as a group rather than have a bunch of  
> discrete repositories, and I read that the forest extension is not in a  
> working state.)
> 
> I wanted to cat an old version of a.  But when I do ``hg cat -r  
> OLD-VERSION-BEFORE-COPY a'' in foo', hg tells me ``a:  No such file in rev  
> d4254567f596''.  I assume this is because none of foo' existed in that old  
> revision.
> 
> Is this a bug or perhaps a misfeature?  It was not what I was expecting.   
> Since ``hg cat'' is used to spit out an unversioned copy of a file at a  
> certain revision, it would make sense to me if it would follow history  
> through copies and renames and such.

"hg cat" spits the content of file "foo" belonging to a specific revision REV manifest. What you want is the content of your working directory (CURRENT) file "foo" as it would appear in REV
- What if "foo" already exists in REV but is completely unrelated to the "foo" you are talking about in CURRENT ? Which one do you pick : the unrelated "foo" or a possibly related but renamed ancestor "bar" ?
- What if "foo" does not exist in CURRENT but you know it is in REV and want to see it. Should "hg cat --rev REV foo" display the "foo" in REV ? Or should it say "cannot find "foo" in CURRENT" ?

I am not saying the behaviour you suggests is meaningless, just that it makes things more complicated while the current one is straightforward. Having a command to answer "what was the name of this working directory file in revision REV ?" would be a first step.

--
Patrick Mézard



More information about the Mercurial mailing list