Discussion:
[fossil-users] web UI: recursive diff (like 'vdiff&sbs=0') starting in subtree of repo?
Michai Ramakers
2014-01-21 17:26:50 UTC
Permalink
Hello,

is this possible in trunk atm: display a recursive diff like what
'vdiff&sbs=0' provides, but starting in a subdir of the repo instead
of its root?

(imagine 'vdiff' having a 'dir=' argument)

Michai
Stephan Beal
2014-01-21 17:39:53 UTC
Permalink
Post by Michai Ramakers
is this possible in trunk atm: display a recursive diff like what
'vdiff&sbs=0' provides, but starting in a subdir of the repo instead
of its root?
(imagine 'vdiff' having a 'dir=' argument)
Not currently, no. However... looking over the code now, i don't think that
would be difficult to implement. i'll see if i can get a quick prototype
done this evening. After that's done, someone out there will then say, "but
if foo/bar is renamed to baz/foo, it should track that as well," at which
point i'll say, "patches are welcomed" ;).
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Michai Ramakers
2014-01-21 18:09:55 UTC
Permalink
Hello Stephan,
Post by Stephan Beal
Post by Michai Ramakers
is this possible in trunk atm: display a recursive diff like what
'vdiff&sbs=0' provides, but starting in a subdir of the repo instead
of its root?
(imagine 'vdiff' having a 'dir=' argument)
Not currently, no. However... looking over the code now, i don't think that
would be difficult to implement. i'll see if i can get a quick prototype
done this evening. After that's done, someone out there will then say, "but
if foo/bar is renamed to baz/foo, it should track that as well," at which
point i'll say, "patches are welcomed" ;).
that would be great, thx in advance.

Michai
Stephan Beal
2014-01-21 18:18:42 UTC
Permalink
Post by Michai Ramakers
Hello Stephan,
Post by Michai Ramakers
is this possible in trunk atm: display a recursive diff like what
'vdiff&sbs=0' provides, but starting in a subdir of the repo instead
of its root?
Please give this a try:

http://fossil-scm.org/index.html/timeline?r=vdiff-subdir

Notes:

- you currently have to manually add "dir=..." to the URL. i don't see a
way which we could sensibly provide a list of directories via, e.g., a
dropdown list, as that list could be arbitrarily large.

- "dir=..." does not get added to the other buttons on the vdiff page (e.g.
the sbs toggle). That's a missing feature.

- "dir" is actually a misnomer - it does a string prefix check, meaning
that dir=test will match anything which has a repo-absolute path starting
with "test", including "test2/..." or "test.foo". To force a proper dir
check, simply suffix a slash to it, e.g.: dir=test/

Here's a commit which contains files from several dirs, which can be used
for testing:

/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&sbs=1&dir=test/

Run that on localhost using this branch, and adjust/remove the dir flag.

Feedback and bug reports are welcomed, as long as nobody says, "but it has
to account for renames..." ;)
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Richard Hipp
2014-01-21 18:26:49 UTC
Permalink
Feedback .... welcomed,...
Maybe use strglob() instead of fossil_strncmp() and change the name of the
parameter from dir= to glob=? Then you do things like ....&glob=*.h to get
just the diffs in header files, for example.
--
D. Richard Hipp
***@sqlite.org
Stephan Beal
2014-01-21 18:28:24 UTC
Permalink
Post by Richard Hipp
Feedback .... welcomed,...
Maybe use strglob() instead of fossil_strncmp() and change the name of the
parameter from dir= to glob=? Then you do things like ....&glob=*.h to get
just the diffs in header files, for example.
Richard Hipp
2014-01-21 18:34:00 UTC
Permalink
Post by Richard Hipp
Feedback .... welcomed,...
Maybe use strglob() instead of fossil_strncmp() and change the name of
the parameter from dir= to glob=? Then you do things like ....&glob=*.h to
get just the diffs in header files, for example.
Stephan Beal
2014-01-21 18:40:57 UTC
Permalink
There is an undocumented parameter to /vdiff that lets you specify a
regular expression of which files to display. So the functionality that
Machai wants is already in trunk. Just add "&re=prefix/.*" to the query.
No need for the "&dir=" parameter.
LOL! Great :). Next time i'll take a look at the existing code before
grafting on to it.

The parameter is named 'regex', but it doesn't seem to be doing anything
for me:

http://fossil-scm.org/index.html/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&regex=test/.*

Interestingly, changing the regex slightly causes a completely different
behaviour:

http://fossil-scm.org/index.html/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&regex=test/*
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Stephan Beal
2014-01-21 18:42:24 UTC
Permalink
Post by Stephan Beal
The parameter is named 'regex', but it doesn't seem to be doing anything
http://fossil-scm.org/index.html/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&regex=test/.*
Misunderstanding on my part: that matches only the changes themselves, not
the filenames.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Richard Hipp
2014-01-21 18:45:03 UTC
Permalink
Post by Stephan Beal
Post by Stephan Beal
The parameter is named 'regex', but it doesn't seem to be doing anything
http://fossil-scm.org/index.html/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&regex=test/.*
Misunderstanding on my part: that matches only the changes themselves, not
the filenames.
Huh. Ok. But at least now you have a design pattern to follow for a
separate parameter that matches the filenames....
--
D. Richard Hipp
***@sqlite.org
Stephan Beal
2014-01-21 18:53:11 UTC
Permalink
Post by Richard Hipp
Huh. Ok. But at least now you have a design pattern to follow for a
Post by Richard Hipp
separate parameter that matches the filenames....
i was already done with a slightly different approach by the time this mail
arrived:

http://fossil-scm.org/index.html/info/fa16c3a72b

that one integrates directly with the existing pFileFrom/To iteration, so
it should be free to undesired iteration side effects.

@Michai: please try something like this URL using that branch:

/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&glob=*.h
/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&glob=test/*

The glob is a much better solution than dir=...
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Michai Ramakers
2014-01-21 19:05:30 UTC
Permalink
Post by Stephan Beal
/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&glob=*.h
/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&glob=test/*
that works really well, thank you both for the quick action :)

(I sent mail to this list just now, unfortunately with wrong
sender-address so it never reached it. It was about 'dir=' not working
in some cases. If interested I can re-send, but I think it's not
necessary anymore.)

Michai
Martin Gagnon
2014-01-21 19:13:56 UTC
Permalink
Huh.  Ok.  But at least now you have a design pattern to follow for a
separate parameter that matches the filenames....
i was already done with a slightly different approach by the time this mail
http://fossil-scm.org/index.html/info/fa16c3a72b
that one integrates directly with the existing pFileFrom/To iteration, so it
should be free to undesired iteration side effects.
/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&glob=*.h
/vdiff?from=7e9633a9b3f086c5&to=2864db30806fc5e3&glob=test/*
The glob is a much better solution than dir=...
Nice job...

Would be nice to have this kind of feature to the timeline page (or a
new page)... Showing the checkins that affect at least one file inside
a subdir.

This could give an history of checkins per subdir. This would be useful
for big repo where different developer work on different part of the
tree.

This kind of page could be accessible from the tree/ page, as a link
called "history" beside each dir.

What do you think ?
--
Martin G.
Stephan Beal
2014-01-21 19:20:11 UTC
Permalink
Post by Martin Gagnon
Would be nice to have this kind of feature to the timeline page (or a
new page)... Showing the checkins that affect at least one file inside
a subdir.
This could give an history of checkins per subdir. This would be useful
for big repo where different developer work on different part of the
tree.
This kind of page could be accessible from the tree/ page, as a link
called "history" beside each dir.
What do you think ?
i think it's an excellent idea, but too much for me this evening - it's
about an hour before bedtime ;). i will certainly look at doing something
similar for the CLI diff in the near future. Timeline, as you say, is also
an interesting candidate for such a feature, but the timeline is a real
beast (quite possibly the single most complex feature in fossil).

FYI: i'm currently working on getting the glob= parameter propagated across
the various toggle buttons.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Martin Gagnon
2014-01-21 20:30:54 UTC
Permalink
Post by Martin Gagnon
Would be nice to have this kind of feature to the timeline page (or a
new page)...  Showing the checkins that affect at least one file inside
a subdir.
This could give an history of checkins per subdir. This would be useful
for big repo where different developer work on different part of the
tree.
This kind of page could be accessible from the tree/ page, as a link
called "history" beside each dir.
What do you think ?
i think it's an excellent idea, but too much for me this evening - it's about
an hour before bedtime ;). i will certainly look at doing something similar for
the CLI diff in the near future. Timeline, as you say, is also an interesting
candidate for such a feature, but the timeline is a real beast (quite possibly
the single most complex feature in fossil).
Or may be it could be based on the /finfo with a new nameglob= parameter
instead. We could get the directory checkins history with something
like:
.../finfo?nameglob=src/*

Would it be easier than doing it from the /timeline page ?
--
Martin G.
Michai Ramakers
2014-01-21 19:22:09 UTC
Permalink
Post by Martin Gagnon
Would be nice to have this kind of feature to the timeline page (or a
new page)... Showing the checkins that affect at least one file inside
a subdir.
This could give an history of checkins per subdir. This would be useful
for big repo where different developer work on different part of the
tree.
This kind of page could be accessible from the tree/ page, as a link
called "history" beside each dir.
What do you think ?
that would be very useful to me at least. I was doing exactly this -
seeing how a specific subdir had changed.

(Slightly related, there was a post on here a little while ago, about
big-per-project-repo vs repo-for-each-subpart-of-project.)

When looking at the timeline alone, it's a bit cumbersome to filter
out the checkins that affect the dir I'm interested in.

When looking at the vdiff (now with 'glob=') output, you know what
changed, but it's still a bit cumbersome to get per-file history for
each one.

(I was taking the 'vdiff' approach, just before this thread began.)

If there are other workflows that make this easier, I would be very interested.

Michai
Stephan Beal
2014-01-21 19:41:59 UTC
Permalink
Post by Michai Ramakers
When looking at the timeline alone, it's a bit cumbersome to filter
out the checkins that affect the dir I'm interested in.
Somewhere around here i have an old SQL view which might be useful in this
regard...

http://fossil.wanderinghorse.net/repos/fwiki/editor/wiki-editor-goco.html?page=FossilQueries.goco

That view can be used to find commits containing specific files. Indeed, it
seems to allow us to figure out in which commit a given file was modified:

sqlite> select count(checkin) from x;
count(checkin)
863
sqlite> select count(checkin) from x where name='Makefile';
count(checkin)
61
sqlite> select checkin, datetime from x where name='Makefile' order by
datetime desc limit 3;
checkin|datetime
cb449b34ea9207f4c188f450615aa50c7d70aa53|2012-07-23 17:12:36
d64bf0af6eee2c42d5401a551743139a0b1e0339|2012-02-27 18:49:22
71aaf54186a2e75db897f6e38428c3ee79592bac|2012-02-18 21:46:19

Is distinctly different from the recent commits which all implicitly
contain 'Makefile':

sqlite> select checkin, datetime from x order by datetime desc limit 3;
checkin|datetime
8fd4f33e244ef9eb203bb7494d8f7db73978587f|2014-01-21 15:54:14
e2afbc88d3823484015d0bdbefce44a9d3147e3d|2014-01-21 15:45:56
fafbd6997a7083fdfd0fd0539dd754edfb1b4994|2013-09-09 06:11:21

Indeed, those commits were all build-related fixes....

[***@host:~/cvs/fossil]$ ./libfossil/f-acat cb449b34ea92 -R cson.fsl |
head
C minor\sbuild\sfix.
D 2012-07-23T19:12:36.114
F Makefile 3fba972e6e7376bf1a4e19283fba6e4ccbbffa09
...

[***@host:~/cvs/fossil]$ ./libfossil/f-acat 71aaf54186a2e75db8 -R
cson.fsl | head
C build\sfixes\sfor\sgcc\s4.6.
D 2012-02-18T22:46:19.550
F Makefile 6125b20d93e28c8a883a249f7ce343b3729aaf3c

...

Hmmmm... i'll have to take a closer look at that later - that may very well
provide the info you're looking for. It's currently
winding-down-for-bed-time here.

When looking at the vdiff (now with 'glob=') output, you know what
Post by Michai Ramakers
changed, but it's still a bit cumbersome to get per-file history for
each one.
BTW: just checked in: the glob parameter now propagates via the various
toggle buttons and a button has been added to clear the glob.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Michai Ramakers
2014-01-21 19:57:12 UTC
Permalink
Post by Stephan Beal
BTW: just checked in: the glob parameter now propagates via the various
toggle buttons and a button has been added to clear the glob.
propagation seems to work well, thx very much.
I'll try to look at the SQL magic tomorrow in more detail.

Michai
Stephan Beal
2014-01-21 20:06:15 UTC
Permalink
Post by Michai Ramakers
Post by Stephan Beal
BTW: just checked in: the glob parameter now propagates via the various
toggle buttons and a button has been added to clear the glob.
propagation seems to work well, thx very much.
:)
Post by Michai Ramakers
I'll try to look at the SQL magic tomorrow in more detail.
i didn't mean to imply that you should use that as part of your workflow
(unless you really want to), but more as a reminder to self that that type
of filtering seems reasonable to do at a fairly high level, given a view
like that one. i'll take a look at how we can do that (or something
similar) to filter other pages in interesting ways. i'm hesitant to tinker
with the timeline view too much because it's a beast[1], but there may be
other places we can use that. Suggestions are welcomed.


[1] = http://fossil-scm.org/index.html/finfo?name=src/timeline.c OMG,
that's the first time i've seen the /dir view since drh re-did it over the
holidays. That's beautiful.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Stephan Beal
2014-01-21 18:27:22 UTC
Permalink
Post by Stephan Beal
http://fossil-scm.org/index.html/timeline?r=vdiff-subdir
Loading...