Index: src/finfo.c ================================================================== --- src/finfo.c +++ src/finfo.c @@ -509,11 +509,11 @@ @ %z(href("%R/annotate?filename=%h&checkin=%s",z,zCkin)) @ [annotate] @ %z(href("%R/blame?filename=%h&checkin=%s",z,zCkin)) @ [blame] @ %z(href("%R/timeline?n=200&uf=%!S",zUuid))[check-ins using] - if( fpid ){ + if( fpid>0 ){ @ %z(href("%R/fdiff?sbs=1&v1=%!S&v2=%!S",zPUuid,zUuid))[diff] } } if( fDebug & FINFO_DEBUG_MLINK ){ int ii; Index: src/manifest.c ================================================================== --- src/manifest.c +++ src/manifest.c @@ -1344,10 +1344,11 @@ ** A single mlink entry is added for every file that changed content, ** name, and/or permissions going from pid to cid. ** ** Deleted files have mlink.fid=0. ** Added files have mlink.pid=0. +** File added by merge have mlink.pid=-1 ** Edited files have both mlink.pid!=0 and mlink.fid!=0 */ static void add_mlink( int pmid, Manifest *pParent, /* Parent check-in */ int mid, Manifest *pChild, /* The child check-in */ @@ -1801,14 +1802,13 @@ pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/); add_mlink(pid, 0, rid, p, i==0); if( i==0 ) parentid = pid; } if( p->nParent>1 ){ - /* Remove incorrect MLINK create-file entries that arise when a - ** file is added by merge. */ + /* Change MLINK.PID from 0 to -1 for files that are added by merge. */ db_multi_exec( - "DELETE FROM mlink" + "UPDATE mlink SET pid=-1" " WHERE mid=%d" " AND pid=0" " AND fnid IN " " (SELECT fnid FROM mlink WHERE mid=%d GROUP BY fnid" " HAVING count(*)<%d)", Index: src/schema.c ================================================================== --- src/schema.c +++ src/schema.c @@ -249,22 +249,24 @@ @ -- pid = Parent file ID. @ -- fnid = File Name ID. @ -- pfnid = Parent File Name ID. @ -- isaux = pmid IS AUXiliary parent, not primary parent @ -- -@ -- pid==0 if the file is added by check-in mid. -@ -- fid==0 if the file is removed by check-in mid. +@ -- pid==0 if the file is added by check-in mid. +@ -- pid==(-1) if the file exists in a merge parents but not in the primary +@ -- parent. In other words, if the file file was added by merge. +@ -- fid==0 if the file is removed by check-in mid. @ -- @ CREATE TABLE mlink( -@ mid INTEGER REFERENCES plink(cid), -- Check-in that contains fid -@ fid INTEGER REFERENCES blob, -- New file content. 0 if deleted -@ pmid INTEGER REFERENCES plink(cid), -- Check-in that contains pid -@ pid INTEGER REFERENCES blob, -- Prev file content. 0 if new -@ fnid INTEGER REFERENCES filename, -- Name of the file -@ pfnid INTEGER REFERENCES filename, -- Previous name. 0 if unchanged -@ mperm INTEGER, -- File permissions. 1==exec -@ isaux BOOLEAN DEFAULT 0 -- TRUE if pmid is the primary +@ mid INTEGER, -- Check-in that contains fid +@ fid INTEGER, -- New file content. 0 if deleted +@ pmid INTEGER, -- Check-in that contains pid +@ pid INTEGER, -- Prev file content. 0 if new. -1 merge +@ fnid INTEGER REFERENCES filename, -- Name of the file +@ pfnid INTEGER REFERENCES filename, -- Previous name. 0 if unchanged +@ mperm INTEGER, -- File permissions. 1==exec +@ isaux BOOLEAN DEFAULT 0 -- TRUE if pmid is the primary @ ); @ CREATE INDEX mlink_i1 ON mlink(mid); @ CREATE INDEX mlink_i2 ON mlink(fnid); @ CREATE INDEX mlink_i3 ON mlink(fid); @ CREATE INDEX mlink_i4 ON mlink(pid); Index: src/sqlite3.c ================================================================== --- src/sqlite3.c +++ src/sqlite3.c @@ -318,11 +318,11 @@ ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.8.10" #define SQLITE_VERSION_NUMBER 3008010 -#define SQLITE_SOURCE_ID "2015-05-04 19:13:25 850c11866686a7b39d7b163fb60898c11283688e" +#define SQLITE_SOURCE_ID "2015-05-05 18:52:54 04afa3febee32854fbb09ef8d4ffffd432119716" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** @@ -21590,11 +21590,10 @@ case '0': flag_zeropad = 1; break; default: done = 1; break; } }while( !done && (c=(*++fmt))!=0 ); /* Get the field width */ - width = 0; if( c=='*' ){ if( bArgList ){ width = (int)getIntArg(pArgList); }else{ width = va_arg(ap,int); @@ -21614,11 +21613,10 @@ width = wx & 0x7fffffff; } /* Get the precision */ if( c=='.' ){ - precision = 0; c = *++fmt; if( c=='*' ){ if( bArgList ){ precision = (int)getIntArg(pArgList); }else{ @@ -55477,11 +55475,11 @@ } assert( nReserve>=0 && nReserve<=255 ); if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE && ((pageSize-1)&pageSize)==0 ){ assert( (pageSize & 7)==0 ); - assert( !pBt->pPage1 && !pBt->pCursor ); + assert( !pBt->pCursor ); pBt->pageSize = (u32)pageSize; freeTempSpace(pBt); } rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve); pBt->usableSize = pBt->pageSize - (u16)nReserve; @@ -71814,11 +71812,10 @@ }else{ assert( rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ); assert( rc==SQLITE_OK || db->nDeferredCons>0 || db->nDeferredImmCons>0 ); rc = p->rc ? SQLITE_ERROR : SQLITE_DONE; } - pOp = &aOp[pcx]; goto vdbe_return; } /* Opcode: Integer P1 P2 * * * ** Synopsis: r[P2]=P1 @@ -76742,11 +76739,10 @@ if( rc ){ eNew = eOld; } eNew = sqlite3PagerSetJournalMode(pPager, eNew); - pOut = &aMem[pOp->p2]; pOut->flags = MEM_Str|MEM_Static|MEM_Term; pOut->z = (char *)sqlite3JournalModename(eNew); pOut->n = sqlite3Strlen30(pOut->z); pOut->enc = SQLITE_UTF8; sqlite3VdbeChangeEncoding(pOut, encoding); @@ -84054,11 +84050,11 @@ int i; u32 m = 0; if( pList ){ for(i=0; inExpr; i++){ Expr *pExpr = pList->a[i].pExpr; - if( ALWAYS(pExpr) ) m |= pList->a[i].pExpr->flags; + if( ALWAYS(pExpr) ) m |= pExpr->flags; } } return m; } @@ -130865,10 +130861,17 @@ #ifdef SQLITE_ENABLE_RTREE if( !db->mallocFailed && rc==SQLITE_OK){ rc = sqlite3RtreeInit(db); } #endif + +#ifdef SQLITE_ENABLE_DBSTAT_VTAB + if( !db->mallocFailed && rc==SQLITE_OK){ + int sqlite3_dbstat_register(sqlite3*); + rc = sqlite3_dbstat_register(db); + } +#endif /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking ** mode. Doing nothing at all also makes NORMAL the default. */ @@ -155227,11 +155230,11 @@ ** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script ** for an example implementation. */ #if (defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)) \ - && !defined(SQLITE_OMIT_VIRTUAL_TABLE) + && !defined(SQLITE_OMIT_VIRTUALTABLE) /* ** Page paths: ** ** The value of the 'path' column describes the path taken from the Index: src/sqlite3.h ================================================================== --- src/sqlite3.h +++ src/sqlite3.h @@ -111,11 +111,11 @@ ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.8.10" #define SQLITE_VERSION_NUMBER 3008010 -#define SQLITE_SOURCE_ID "2015-05-04 19:13:25 850c11866686a7b39d7b163fb60898c11283688e" +#define SQLITE_SOURCE_ID "2015-05-05 18:52:54 04afa3febee32854fbb09ef8d4ffffd432119716" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** Index: src/timeline.c ================================================================== --- src/timeline.c +++ src/timeline.c @@ -499,11 +499,11 @@ && zType[0]=='c' && g.perm.Hyperlink ){ int inUl = 0; if( !fchngQueryInit ){ db_prepare(&fchngQuery, - "SELECT (pid==0) AS isnew," + "SELECT pid," " fid," " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," " (SELECT uuid FROM blob WHERE rid=fid)," " (SELECT uuid FROM blob WHERE rid=pid)," " (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm" @@ -517,11 +517,12 @@ fchngQueryInit = 1; } db_bind_int(&fchngQuery, ":mid", rid); while( db_step(&fchngQuery)==SQLITE_ROW ){ const char *zFilename = db_column_text(&fchngQuery, 2); - int isNew = db_column_int(&fchngQuery, 0); + int isNew = db_column_int(&fchngQuery, 0)<=0; + int isMergeNew = db_column_int(&fchngQuery, 0)<0; int fid = db_column_int(&fchngQuery, 1); int isDel = fid==0; const char *zOldName = db_column_text(&fchngQuery, 5); const char *zOld = db_column_text(&fchngQuery, 4); const char *zNew = db_column_text(&fchngQuery, 3); @@ -546,12 +547,17 @@ zA = href("%R/artifact/%!S",fid?zNew:zOld); if( content_is_private(fid) ){ zUnpub = UNPUB_TAG; } if( isNew ){ - @
  • %s(zA)%h(zFilename)%s(zId) %s(zUnpub) (new file)   - @ %z(href("%R/artifact/%!S",zNew))[view]
  • + @
  • %s(zA)%h(zFilename)%s(zId) %s(zUnpub) + if( isMergeNew ){ + @ (added by merge) + }else{ + @ (new file) + } + @   %z(href("%R/artifact/%!S",zNew))[view]
  • }else if( isDel ){ @
  • %s(zA)%h(zFilename) (deleted)
  • }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){ @
  • %h(zOldName) → %s(zA)%h(zFilename)%s(zId) @ %s(zUnpub) %z(href("%R/artifact/%!S",zNew))[view]
  • @@ -1873,11 +1879,11 @@ fossil_free(zFree); if(verboseFlag){ if( !fchngQueryInit ){ db_prepare(&fchngQuery, - "SELECT (pid==0) AS isnew," + "SELECT (pid<=0) AS isnew," " (fid==0) AS isdel," " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," " (SELECT uuid FROM blob WHERE rid=fid)," " (SELECT uuid FROM blob WHERE rid=pid)" " FROM mlink"