Uploading Diffs: So close & yet so far

I’ve been working on adding diffs to the fill-database script for the last two weeks now.  This part has been a lot more challenging that I thought it would be, it definitely hasn’t been as easy as the other two parts.  I started by examining the diffviewer/forms.py file for an example on how to upload diffs & reworked that code into my own.  Here I created a subfunction that first found the working directory of the repository:

diff_dir = str(os.path.abspath(sys.argv[0] +’manage.py/../scmtools/testdata’))

After which I filled out the appropriate fields (diffset, diffset_history, etc).  It was exciting to see this work, and discovering that I could just pass in the diffset_history field so that one review request could have several diffs variations.  Things finally were starting to make sense.

Unfortunately this wasn’t the greatest way to do things, as Christian pointed out.  Instead I could just have used an instance of the forms.py, which made the process a whole lot simpler.  At least I have a better understanding of the forms.py now.  So all I had to do was call an instance of the form.py and follow the general creation process.  Fortunately this seemed to work pretty easily, with one small exception.

For some reason I couldn’t upload a modified diff, it would just give the error ‘not found in the repository’.  Christian let me know that I needed to setup a test repository, like a repository inside a repository.  I didn’t really understand at the time but now I do.  In a separate directory I created a clone (git clone) of the test repository I wanted to use from my existing repository version of reviewboard.  For instance, my existing repository of reviewboard has some test repositories in /scmtools/testdata (such as git_repo).  Cloning this repository to a completely different location on my harddrive gave me a ‘new’ repository.  From here I could make changes, commit them, & then push the changes back up to my original repository, where the fill-database program could now see the modified file.  Its actually kind of neat, in my test repository I actually have a master branch that I can commit to. It gives the illusion of having great power! (wa-ha-ha)

Now my fill-database program has been posted to the global reviewboard awaiting commenting & critiques.  Once any of those changes are done I will be able to move on to adding comments to the existing diffs.  Then it will be on to a new project.   I’m a little worried time-wise about starting another project, since by the time I’m done this one I’ll only have about a month left before our April 8th screen capture posts are due, but hopefully the next project won’t be too difficult conceptually.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s