Diff
Not logged in

Differences From Artifact [df19851114]:

To Artifact [a345d96a8b]:


56
57
58
59
60
61
62



63

64
65
66

67
68
69
70
71

72
73
74
75
76
77
78
79
80
81
82
83




84
85



86
87
88
89
90
91
92
56
57
58
59
60
61
62
63
64
65

66
67
68

69
70

71


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88


89
90
91
92
93
94
95
96
97
98







+
+
+
-
+


-
+

-

-
-
+












+
+
+
+
-
-
+
+
+







  iOffset = zOffset ? atoi(zOffset) : 0;
  if (g.argc<3) {
    usage("FILENAME");
  }
  file_tree_name(g.argv[2], &dest, 1);
  zFilename = blob_str(&dest);
  db_prepare(&q,
    "SELECT "
    "       (SELECT uuid FROM blob WHERE rid=mlink.fid),"  /* New file */
    "       (SELECT uuid FROM blob WHERE rid=mlink.mid),"  /* The check-in */
    "SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
    "       date(event.mtime,'localtime'),"
    "       coalesce(event.ecomment, event.comment),"
    "       coalesce(event.euser, event.user)"
    "  FROM mlink, blob b, event, blob ci"
    "  FROM mlink, event"
    " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
    "   AND b.rid=mlink.fid"
    "   AND event.objid=mlink.mid"
    "   AND event.objid=ci.rid"
    " ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
    " ORDER BY event.mtime DESC LIMIT %d OFFSET %d /*sort*/",
    zFilename, iLimit, iOffset
  );
 
  printf("History of %s\n", zFilename);
  while( db_step(&q)==SQLITE_ROW ){
    const char *zFileUuid = db_column_text(&q, 0);
    const char *zCiUuid = db_column_text(&q, 1);
    const char *zDate = db_column_text(&q, 2);
    const char *zCom = db_column_text(&q, 3);
    const char *zUser = db_column_text(&q, 4);
    char *zOut;
    printf("%s ", zDate);
    if( zFileUuid==0 ){
      zOut = sqlite3_mprintf("[%.10s] DELETED %s (user: %s)",
                              zCiUuid, zCom, zUser);
    }else{
    zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])",
                            zCiUuid, zCom, zUser, zFileUuid);
      zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])",
                              zCiUuid, zCom, zUser, zFileUuid);
    }
    comment_print(zOut, 11, 79);
    sqlite3_free(zOut);
  }
  db_finalize(&q);
  blob_reset(&dest);
}

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125









126
127
128


129
130
131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156










157
158
159
160
161
162
163
115
116
117
118
119
120
121










122
123
124
125
126
127
128
129
130
131


132
133
134

135


136
137
138
139
140
141
142
143
144
145
146
147
148











149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165







-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
-
+
+

-

-
-
+












-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+







  style_header("File History");
  login_anonymous_available();

  zPrevDate[0] = 0;
  zFilename = PD("name","");
  db_prepare(&q,
    "SELECT"
    " substr(b.uuid,1,10),"
    " datetime(event.mtime,'localtime'),"
    " coalesce(event.ecomment, event.comment),"
    " coalesce(event.euser, event.user),"
    " mlink.pid,"
    " mlink.fid,"
    " (SELECT substr(uuid,1,10) FROM blob WHERE rid=mlink.pid),"
    " (SELECT substr(uuid,1,10) FROM blob WHERE rid=mlink.fid),"
    " ci.uuid,"
    " event.bgcolor,"
    " datetime(event.mtime,'localtime'),"            /* Date of change */
    " coalesce(event.ecomment, event.comment),"      /* Check-in comment */
    " coalesce(event.euser, event.user),"            /* User who made chng */
    " mlink.pid,"                                    /* File rid */
    " mlink.fid,"                                    /* Parent file rid */
    " (SELECT uuid FROM blob WHERE rid=mlink.pid),"  /* Parent file uuid */
    " (SELECT uuid FROM blob WHERE rid=mlink.fid),"  /* Current file uuid */
    " (SELECT uuid FROM blob WHERE rid=mlink.mid),"  /* Check-in uuid */
    " event.bgcolor,"                                /* Background color */
    " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
                                " AND tagxref.rid=mlink.mid)"
    "  FROM mlink, blob b, event, blob ci"
                                " AND tagxref.rid=mlink.mid)" /* Tags */
    "  FROM mlink, event"
    " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
    "   AND b.rid=mlink.fid"
    "   AND event.objid=mlink.mid"
    "   AND event.objid=ci.rid"
    " ORDER BY event.mtime DESC",
    " ORDER BY event.mtime DESC /*sort*/",
    TAG_BRANCH,
    zFilename
  );
  blob_zero(&title);
  blob_appendf(&title, "History of ");
  hyperlinked_path(zFilename, &title);
  @ <h2>%b(&title)</h2>
  blob_reset(&title);
  pGraph = graph_init();
  @ <div id="canvas" style="position:relative;width:1px;height:1px;"></div>
  @ <table cellspacing=0 border=0 cellpadding=0>
  while( db_step(&q)==SQLITE_ROW ){
    const char *zUuid = db_column_text(&q, 0);
    const char *zDate = db_column_text(&q, 1);
    const char *zCom = db_column_text(&q, 2);
    const char *zUser = db_column_text(&q, 3);
    int fpid = db_column_int(&q, 4);
    int frid = db_column_int(&q, 5);
    const char *zFpuid = db_column_text(&q, 6);
    const char *zFuid = db_column_text(&q, 7);
    const char *zCkin = db_column_text(&q,8);
    const char *zBgClr = db_column_text(&q, 9);
    const char *zBr = db_column_text(&q, 10);
    const char *zDate = db_column_text(&q, 0);
    const char *zCom = db_column_text(&q, 1);
    const char *zUser = db_column_text(&q, 2);
    int fpid = db_column_int(&q, 3);
    int frid = db_column_int(&q, 4);
    const char *zPUuid = db_column_text(&q, 5);
    const char *zUuid = db_column_text(&q, 6);
    const char *zCkin = db_column_text(&q,7);
    const char *zBgClr = db_column_text(&q, 8);
    const char *zBr = db_column_text(&q, 9);
    int gidx;
    char zTime[10];
    char zShort[20];
    char zShortCkin[20];
    if( zBr==0 ) zBr = "trunk";
    gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr);
    if( memcmp(zDate, zPrevDate, 10) ){
174
175
176
177
178
179
180

181
182
183
184
185
186









187
188
189
190
191

192
193

194
195

196
197
198

199
200
201
202
203
204
205
176
177
178
179
180
181
182
183






184
185
186
187
188
189
190
191
192
193
194
195
196

197
198

199
200

201
202

203
204
205
206
207
208
209
210
211







+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+




-
+

-
+

-
+

-

+







    if( zBgClr && zBgClr[0] ){
      @ <td valign="top" align="left" bgcolor="%h(zBgClr)">
    }else{
      @ <td valign="top" align="left">
    }
    sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
    sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
    if( zUuid ){
    if( g.okHistory ){
      @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%s(zShort)]</a>
    }else{
      @ [%s(zShort)]
    }
    @ part of check-in
      if( g.okHistory ){
        @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
      }else{
        @ [%S(zUuid)]
      }
      @ part of check-in
    }else{
      @ <b>Deleted</b> by check-in
    }
    hyperlink_to_uuid(zShortCkin);
    @ %h(zCom) (user: 
    hyperlink_to_user(zUser, zDate, "");
    @ branch: %h(zBr))
    if( g.okHistory ){
    if( g.okHistory && zUuid ){
      if( fpid ){
        @ <a href="%s(g.zTop)/fdiff?v1=%s(zFpuid)&amp;v2=%s(zFuid)">[diff]</a>
        @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
      }
      @ <a href="%s(g.zTop)/annotate?checkin=%s(zShortCkin)&amp;filename=%h(zFilename)">
      @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(zFilename)">
      @ [annotate]</a>
      @ </td>
    }
    @ </td>
  }
  db_finalize(&q);
  if( pGraph ){
    graph_finish(pGraph, 1);
    if( pGraph->nErr ){
      graph_free(pGraph);
      pGraph = 0;