Posts Tagged Project
v0.3 Release - Fixing the Problems with my Patch for bug 459727
Posted by Sid in Mercurial Project, Open Source on December 3rd, 2008
I’ve been busy trying to fix problems that had arised regarding the patch I submitted for bug 459727. All that is being done right now is fixing various small problems but the overall functionality remains the same. So the following are the solutions to the problems that jorendorff identified:
To calculate the max SELECT COUNT(*) FROM … should be used
Changed my implementation to use gettotalpushlogentries(conn) which performs a select statement. I’ve gotten rid of getMaxEntries() since it is no longer required.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | def pushes_worker(repo, startID=0, endID=None): stmt = 'SELECT id, user, date, rev, node from pushlog INNER JOIN changesets ON id = pushid WHERE id > ? %s ORDER BY id ASC, rev ASC' args = (startID,) if endID is not None: stmt = stmt % 'and id <= ?' args = (startID, endID) else: stmt = stmt % "" if os.path.basename(repo.path) != '.hg': repo.path = os.path.join(repo.path, '.hg') conn = sqlite.connect(os.path.join(repo.path, 'pushlog2.db')) pushes = {} for id, user, date, rev, node in conn.execute(stmt, args): mergeData = [] ctx = repo.changectx(node) if len(ctx.parents()) > 1: for cs in ctx.parents(): mergeData.append(hex(cs.node()) + '|-|' + clean(person(cs.user())) + '|-|' + clean(cs.description())) if id in pushes: pushes[id]['changesets'].append(node) pushes[id]['mergeData'].append(mergeData) else: pushes[id] = {'user': user, 'date': date, 'changesets': [node], 'formattedDate': util.datestr(localdate(date)), 'individualChangeset': hex(ctx.node()), 'author': clean(person(ctx.user())), 'desc': clean(ctx.description()), 'mergeData': mergeData, 'max': gettotalpushlogentries(conn) } return pushes |
`new Function(”return ” + entries.responseText) ()` is saying
`eval(entries.responseText)`, perhaps use `JSON.parse (entries.responseText)`
I haven’t implemented this yet because I want more information on why the way I have done is not the appropriate way. I’ve asked on the bug page (comment 12)but haven’t heard back yet
The page loads more results when the user scrolls. What if the initial results don’t fill up the window?
I added the following CSS to always show a scrollbar no matter what. This should allow the user to scroll even if the initial entries don’t fill up the page.
html { overflow: scroll; overflow-x: auto; }
getMaxEntriesis called, then ’start’ is used once the user scrolls. But the user might scroll before the first result comes back, while start is still zero — a race condition
I changed the implementation to check the value of the start variable before more entries are allowed to load onScroll. If the value of start is still 0 then no entries are allowed to load. The following is the code:
$(window).scroll(function() { if(start > 0) { if($(window).scrollTop() == $(document).height() - $(window).height()) { renderMorePushLogResults(); } } });
Better to move CSS and formatting to stylesheets where possible
I removed explicitly setting the styles of the rows. Now I am just setting the class name of the row so that it uses the preexisting styles for that class name. View lines 37-43 for the code
The JS code isn’t consistently indented
It should be correctly formatted now. View here
This patch seems to contain some non-ASCII characters. Bugzilla doesn’t render it properly
Used &mdash in the places where non-ASCII characters were being used. View lines 73 and 121
In a few places the b tag is used where the server uses the strong tag
Changed the b tags to use strong. View lines 73 and 121
I will be putting up a new patch very soon…
EDIT:
The new patches have been posted here
v0.3 Release - Understanding djc’s Graph View
Posted by Sid in Mercurial Project, Open Source on November 25th, 2008
I’m starting work on a graph view for the pushlog. Frankly, I didn’t know where to begin since I have never really done anything like this before, then again I could say the same thing about the whole project. After having a discussion with jorendorff I was pointed towards djc’s (Dirkjan Ochtman) Graph view for Mercurial. He already has it working and my job is to now understand what he has done and get it working for the pushlog now.
The Source
I downloaded the source from http://hg.intevation.org/mercurial/crew/ using hg clone.
Getting it Running
Getting it running on my browser was pretty simple. Almost identical to what I had to do for the pushlog. Just open up a command prompt and navigate to the directory where you saved the source and call the hg serve command. Then fire up a browser and type in http://localhost:8000 and you should be able to see the graph view.
Understanding the Code
Mercurial crew comes with Mercurial and hgweb. Some of the functionality is implemented in crew/templates/static/graph.js which is what runs on the client side. Also the tmpl file used to render the page is crew/templates/coal/graph.tmpl which imports graph.js to utilize its methods. The template also takes in a parameter, jsdata which contains the graph data. jsdata is populated on the server side by the graph method of the crew/mercurial/hgweb/webcommands.py file. It contains graphmod.graph() which is apparently what does the actual graph layout.
I don’t fully understand this code at the moment. There are many questions going through my mind. For example it seems that the server side code (mercurial.hgweb.webcommands.graph) returns a tmpl so I don’t know whether I should be working from a new tmpl file or can I put my client side code in hg_templates/gitweb_mozilla/pushlog.tmpl like I have been doing all along?
The client side code receives the data from the server side through {jsdata|json} which is all the changeset data. But right now with the pushlog all this is processed through pushlog-feed.py which gives the data to hg_templates\gitweb_mozilla\map that renders the page. So should I be messing with this map file? If not then how can I pass the data to the client side so that I can draw the graph and render it on the page?
The above 2 examples are only some of the questions going through my mind right now. I have told you about them because they are ones that must be answered urgently. It is important that I understand the basic functionality of djc’s Graph view so that I can deduce a way to apply it to my problem.
It is still early days for this feature and I’m still trying to feel my way through it. Hopefully things will pick up as my understanding of this feature increases.
v0.2 Complete
Posted by Sid in Mercurial Project, Open Source on November 15th, 2008
“Takes a deep breath”
Well, I’ve finally completed my v0.2 release. I have to say that it has been tough and grueling. Throughout this period I have struggled to get things done countless times. I’ve hit the proverbial brick wall on so many occasions that I feel like I’m part of the wall now (the wall is like the annoying neighbor that won’t go away). Open source is definitely the course I have spent the most time on this semester. I’ve spent countless hours on this release (I’m guessing around 50-60hrs, at least it feels like that but I may be way off). But don’t get me wrong here. I’m not complaining. I’ve enjoyed myself too. These projects are hard and they will take time to complete. I know and accept that. I am getting better at working with my project too as with everyday that passes I feel I am more confident about my work.
I plan to release the patches for my 3 tasks (view here) tomorrow morning. They will all get reviewed by the Mozilla elders and I hope they get accepted. But, I am not naive. I don’t think they will get accepted immediately. This will be my first time providing a Mozilla patch and so I am sure that I probably have done something that they will not agree with. This is fine. It is all a learning process. Even people that have years of experience can get their patches rejected. Such a thing will not deter me if it happens.
ted, jorendorff and djc have been very helpful. Whenever I have had a question they have guided me onto the right track. Just have a look at my project page to see how many times I have discussed something with them.
We have less than a month left till the semester ends and I need to decide quickly on what I will be working on for my v0.3 release. At this moment I am too exhausted to decide. I will probably make my decision very soon so that I can get going on it. There isn’t much time left. Look out for a future blog post explaining what I will be doing.