Appeal to respect the development history and time tracking

Steve Borho steve at borho.org
Tue Aug 25 15:47:08 UTC 2015


On 08/25, Arne Babenhauserheide wrote:
> Am Dienstag, 25. August 2015, 07:26:45 schrieb Adrian Klaver:
> > > At least add warning that all the date and time stamps of all files and
> > > all directories would be destroyed _forever_ after using Mercurial SCM.
> > 
> > What are you talking about?
> > 
> > Or better yet, can you provide a coherent example?
> 
> Even though I disagree with Mosc (especially on the apes thing), I can
> provide an example:
> 
> I use deft-mode[1] to organize my writings. It shows and filters text
> files in a directory. For each file it shows the title (first line)
> and the data, and it sorts by date.
> 
> This weekend I had partial failure of the data on my system USB stick,
> including that folder. Some files were lost, so I recloned the deft
> directory -- and all files had the same date, so the ordering was wrong.
> 
> I recovered very easily, though:
> 
> hg up null
> for i in {1..12}; do hg up ${i}00; done
> hg up tip
> 
> (I have ~1200 revisions in there)
> 
> With that I had rising mtimes again.
> 
> If I had wanted to spend more time, I could have updated to every
> revisions, but I did not need exact ordering. Being mostly right was
> OK :) (and USK sticks are horribly slow)
> 
> If I had needed the exact time, I???d have used touch:
> 
> for i in {1..1200}; do
>   for j in $(hg log -r $i --template "{files}"); do
>     touch --date "$(hg log -r tip --template "{date|isodate}")" $j;
>   done
> done

I think it would be more efficient to iterate over `hg files` and call
touch on each with the timstamp of its last commit.

for j in $(hg files); do
  touch $j --date "$(hg log -l1 $j --template "{date|isodate}")";
done

This could be wrapped into a 15 line extension as 'hg touch' or
something similar.

-- 
Steve Borho



More information about the Mercurial mailing list