Re: [fossil-users] Out-of-order timestamps cause invalid export files

2015-10-02 Thread David Given
On 28/09/15 23:43, Richard Hipp wrote:
[...]
> I built a test repository with a timewarp (using the --override-date
> on a check-in) and it would not import into git.  Then I fixed the
> check-in time so that was chronological and tried again, and that time
> the import worked great.

Unfortunately, while I only have one *actual* time warp, I have two
parallel lines of checkins connected by said timewarp. (No idea how it
got like that.) Which means that I need to change the timestamp of ~50
checkins to restore causality.

I'll have a think about it, whether it's easier to write a script to
change the timestamps or to change the SQL query to walk the tree.

Thanks!

-- 
┌─── dg@cowlark.com ─ http://www.cowlark.com ─
│ "There is nothing in the world so dangerous --- and I mean *nothing*
│ --- as a children's story that happens to be true." --- Master Li Kao,
│ _The Bridge of Birds_



signature.asc
Description: OpenPGP digital signature
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Out-of-order timestamps cause invalid export files

2015-09-28 Thread David Given
On 28/09/15 21:14, Richard Hipp wrote:
[...]
> Perhaps this following change will help.   Please try and let us know:

Thanks! Unfortunately:

> -"SELECT strftime('%%s',mtime), objid, coalesce(ecomment,comment),"
> +"SELECT strftime('%%s',coalesce(emtime,mtime),"

There's a missing close parenthesis for strftime; this trivially fixed.
But less easy to change is that there's no emtime field in the event table.

There ought to be a cleverer way to do this than just relying on the
timestamp (which can be wrong). Isn't there an SQL example which uses a
recursive query to walk the commit tree? That way we'd be guaranteed to
get a correct order.

-- 
┌─── dg@cowlark.com ─ http://www.cowlark.com ─
│ "There is nothing in the world so dangerous --- and I mean *nothing*
│ --- as a children's story that happens to be true." --- Master Li Kao,
│ _The Bridge of Birds_



signature.asc
Description: OpenPGP digital signature
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Out-of-order timestamps cause invalid export files

2015-09-28 Thread Richard Hipp
On 9/28/15, David Given  wrote:
> Somehow I've ended up in this situation, where the parent of a commit
> has a newer timestamp than the child:
>
> http://cowlark.com/cgi-bin/fossil.cgi/flooded-moon/timeline?f=905a301d7d28267ee35c41e9dd080d1ce7bcec1d
>
> Exporting this leads to the parent commit being emitted before the child
> commit which it references, which causes git to crash out on import.
>
> Even worse, if I try to import the export file into a new Fossil
> repository, it seems to work... except the repository is missing half
> the files! Which suggests that Fossil *should* be crashing out, but isn't.
>
> I've tried modifying the timestamp of the relevant commit, but it
> appears to have no effect.
>

Perhaps this following change will help.   Please try and let us know:

--- src/export.c
+++ src/export.c
@@ -232,16 +232,17 @@
   db_finalize();

   /* Output the commit records.
   */
   db_prepare(,
-"SELECT strftime('%%s',mtime), objid, coalesce(ecomment,comment),"
+"SELECT strftime('%%s',coalesce(emtime,mtime),"
+"   objid, coalesce(ecomment,comment),"
 "   coalesce(euser,user),"
 "   (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)"
 "  FROM event"
 " WHERE type='ci' AND NOT EXISTS (SELECT 1 FROM oldcommit WHERE objid=rid)"
-" ORDER BY mtime ASC",
+" ORDER BY coalesce(emtime,mtime) ASC",
 TAG_BRANCH
   );
   db_prepare(, "INSERT INTO oldcommit VALUES (:rid)");
   while( db_step()==SQLITE_ROW ){
 Stmt q4;


-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Out-of-order timestamps cause invalid export files

2015-09-28 Thread Richard Hipp
On 9/28/15, Richard Hipp  wrote:
> On 9/28/15, David Given  wrote:
>> On 28/09/15 21:14, Richard Hipp wrote:
>> [...]
>>> Perhaps this following change will help.   Please try and let us know:
>>
>> Thanks! Unfortunately:
>>
>>> -"SELECT strftime('%%s',mtime), objid, coalesce(ecomment,comment),"
>>> +"SELECT strftime('%%s',coalesce(emtime,mtime),"
>
> Ugh.  OK.  I looked at the schema, this time, and it turns out that
> the event.mtime field should already reflect the editing time of the
> check-in.  So if you have fixed the timestamps on *all* of your
> check-ins so that they are in chronological order, the export *should*
> work.  If it does not then I don't have any clues why.

I built a test repository with a timewarp (using the --override-date
on a check-in) and it would not import into git.  Then I fixed the
check-in time so that was chronological and tried again, and that time
the import worked great.


>
> You can use the "fossil test-timewarp-list" command to get a list of
> check-ins that are not in chronological order and which need fixing
> up.
>
>>
>> There's a missing close parenthesis for strftime; this trivially fixed.
>> But less easy to change is that there's no emtime field in the event
>> table.
>>
>> There ought to be a cleverer way to do this than just relying on the
>> timestamp (which can be wrong). Isn't there an SQL example which uses a
>> recursive query to walk the commit tree? That way we'd be guaranteed to
>> get a correct order.
>>
>> --
>> ┌─── dg@cowlark.com ─ http://www.cowlark.com ─
>> │ "There is nothing in the world so dangerous --- and I mean *nothing*
>> │ --- as a children's story that happens to be true." --- Master Li Kao,
>> │ _The Bridge of Birds_
>>
>>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
>


-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Out-of-order timestamps cause invalid export files

2015-09-28 Thread Richard Hipp
On 9/28/15, David Given  wrote:
> On 28/09/15 21:14, Richard Hipp wrote:
> [...]
>> Perhaps this following change will help.   Please try and let us know:
>
> Thanks! Unfortunately:
>
>> -"SELECT strftime('%%s',mtime), objid, coalesce(ecomment,comment),"
>> +"SELECT strftime('%%s',coalesce(emtime,mtime),"

Ugh.  OK.  I looked at the schema, this time, and it turns out that
the event.mtime field should already reflect the editing time of the
check-in.  So if you have fixed the timestamps on *all* of your
check-ins so that they are in chronological order, the export *should*
work.  If it does not then I don't have any clues why.

You can use the "fossil test-timewarp-list" command to get a list of
check-ins that are not in chronological order and which need fixing
up.

>
> There's a missing close parenthesis for strftime; this trivially fixed.
> But less easy to change is that there's no emtime field in the event table.
>
> There ought to be a cleverer way to do this than just relying on the
> timestamp (which can be wrong). Isn't there an SQL example which uses a
> recursive query to walk the commit tree? That way we'd be guaranteed to
> get a correct order.
>
> --
> ┌─── dg@cowlark.com ─ http://www.cowlark.com ─
> │ "There is nothing in the world so dangerous --- and I mean *nothing*
> │ --- as a children's story that happens to be true." --- Master Li Kao,
> │ _The Bridge of Birds_
>
>


-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Out-of-order timestamps cause invalid export files

2015-09-28 Thread Joerg Sonnenberger
On Mon, Sep 28, 2015 at 10:12:25PM +0200, David Given wrote:
> There ought to be a cleverer way to do this than just relying on the
> timestamp (which can be wrong). Isn't there an SQL example which uses a
> recursive query to walk the commit tree? That way we'd be guaranteed to
> get a correct order.

Sure, but those ways are significantly more expensive :(

Joerg
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users