Repository Browser

Development related discussion.
User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Repository Browser

Post by Jack » Fri Feb 24, 2012 12:02 am

With the wiki almost finished, I thought it best to start talking about to Repository Browser.



I will be starting the repo browser in a day or so, and the current plan is to have an API type thing to allow SCM's to be dropped in, and allow for multiple repositories.



I would really like for plain text files (.rb, .php, .h, .c, etc) to be viewable with code highlighting.



Code highlighting will be easy with Prettify.



Another thing I want to implement is being able to view different revisions.



The most important part though, is the speed, Traq 2.x has a slow repo browser.



Also need to work out if caching different revisions is worth it or not.
Last edited by Jack on Fri Feb 24, 2012 4:09 am, edited 1 time in total.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Repository Browser

Post by arturo182 » Fri Feb 24, 2012 12:19 am

In Redmine you specify a local clone of a repository and a cron job is scheduled to check it for changes. When a change is found it's added to the db, every changeset (commit) is added to the db and every change (add, edit, delete) in the commit is added to the db.

I think when it comes down to speed vs. db size, I would go for speed, but that's just my opinion.



What Redmine also does is it tries to link commit authors and Redmine users (by email).



Also it would be cool if things like "#20" were replaced with links to tickets in the commit message.



I know I'm writting mostly what Redmine does but it's just so well planned and executed.

User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Re: Repository Browser

Post by Jack » Fri Feb 24, 2012 1:33 am

[quote='arturo182' pid='670' dateline='1330003140']

I know I'm writting mostly what Redmine does but it's just so well planned and executed.

[/quote]



Everything in Traq 3.0 is pretty much based off Redmine. Little to nothing is based off the abomination that is Trac.
Last edited by Jack on Fri Feb 24, 2012 1:33 am, edited 1 time in total.

User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Re: Repository Browser

Post by Jack » Fri Feb 24, 2012 4:17 am

I've added a database dump of the current structure, with the repository tables. I also added the base SCM class.



A few things to point out: the tables are similar to that of what Redmine has.



If you look at the repo_changes table, you will see the "path" and "from_path" columns, these are to be used when a file has been renamed.



So lets say we have "mycalss.php", however we noticed that the filename is a typo, so we rename it to "myclass.php", in the database it would reflect this as:


Code: Select all


'path' => "myclass.php",

'from_path' => "mycalss.php"

 


I also plan to add some extra classes for revisions and such, so things like $revision->changes() can be called to get a list of changed files.



Anyone is welcome to contribute, but before you do please have a read of the wiki on the GitHub page.
Last edited by Jack on Fri Feb 24, 2012 4:36 am, edited 1 time in total.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Repository Browser

Post by arturo182 » Fri Feb 24, 2012 7:51 am

Functions needed:
  • Branches
    • List
    • Check which is default
  • Tags
  • Display how file looked in revision x
  • Display diff
Last edited by arturo182 on Fri Feb 24, 2012 7:51 am, edited 1 time in total.

User avatar
CharleyMartel
Newbie
Posts: 4
Joined: Mon Feb 13, 2012 3:31 am

Re: Repository Browser

Post by CharleyMartel » Fri Feb 24, 2012 4:42 pm

I think it would be beneficial to do as arturo said and allow commits to link to tickets via some sort of hashtag or other method.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Repository Browser

Post by arturo182 » Fri Feb 24, 2012 5:22 pm

It's a matter of a simple regex replacement. And how about adding striketrought for closed tickets?



Just a reminder, I'm sure you know this but it needs to be said:

later, when you're doing repository edition in the project panel, remember to check if the "url" is an existing path, cause the url is going to be a shell executed and we have to be 100% it's injection proof, we don't want it to be something like

Code: Select all

/whatever/.git && format / -rf && git
don't we ;)



And I know that the git user has no power to format root but it's just an example.
Last edited by arturo182 on Fri Feb 24, 2012 5:30 pm, edited 1 time in total.

User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Re: Repository Browser

Post by Jack » Sat Feb 25, 2012 1:06 am

Once I get the repository "API" sorted, I will get started on the code that imports the commits and such.



That part will be responsible for:
  • Importing commits
  • Adding the changes, changesets, etc, to the database
  • Checking commit messages for:
    • (Reopens|Closes|etc) (ticket|issue) #[0-9]+


Note: I will only be working on the Git adapter for the repo browser, any others will need to be created by those two want them. The reason is mostly because I only use Git.
Last edited by Jack on Sat Feb 25, 2012 1:12 am, edited 1 time in total.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Repository Browser

Post by arturo182 » Sat Feb 25, 2012 1:20 am

I don't use svn much these days but maybe I'll try to create an adaptor for it, never used bazaar, mercurial or cvs so can't help with that.

User avatar
CharleyMartel
Newbie
Posts: 4
Joined: Mon Feb 13, 2012 3:31 am

Re: Repository Browser

Post by CharleyMartel » Sat Feb 25, 2012 5:14 am

After I see the format for the Git adapter I can take a look at doing an svn one as git and svn are the two I use most frequently.



I've been thinking about how traq will be able to keep the repo up to date and its a bit of a conundrum. Without doing a commit hook, or some sort of cron job, traq would not be able to tell if a repo has been updated until actually attempting to browse it, that would slow the whole process down significantly.



Are you two kicking around any other ideas?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest