Closed Bug 778369 Opened 10 years ago Closed 10 years ago

Break bzexport down into individual files in an initial attempt at making some reusable pieces

Categories

(Developer Services :: Mercurial: bzexport, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sfink, Assigned: sfink)

References

Details

Attachments

(2 files, 1 obsolete file)

It would be nice if the bugzilla auth grabbing were reusable so we could use it in other tools.

It would be nice if the bugzilla communication were separate so it could also be reused -- or better yet, replaced with something fancier.

It would be nice if things were broken down so that we could write unit tests.

It would be nice if glowing unicorns spontaneously emerged from my rectal orifice.
I do not claim this is pretty. It splits off the bugzilla stuff, though the bzauth.py file still mixes together some configuration fetching and persisting, and it's all pretty raw.

But it seems to still function as before, and at least provides *some* structure.

The one big red flag is that I had to switch to using __init__.py instead of bzexport.py so that I could import the other files. That means people will have to update their ~/.hgrc files. Let me know if there's some easy way to fix that; I'm still not that great with Python.
Attachment #646775 - Flags: review?(josh)
Blocks: 764881
It looks like I can use the mercurial extensions machinery for this (which wraps imp.load_module(), thankfully.)

I haven't tried this under eg Windows to see if the __file__ access is actually correct.
Attachment #653985 - Flags: review?(ted.mielczarek)
Comment on attachment 653985 [details] [diff] [review]
Allow loading bzexport.py for backwards compatibility

Review of attachment 653985 [details] [diff] [review]:
-----------------------------------------------------------------

Clever, but this isn't going to work at all on Windows. I guess bzexport already doesn't work there, so that's probably fine.
Attachment #653985 - Flags: review?(ted.mielczarek) → review+
Actually I'm not sure if this will break Windows or not. Might work okay because you're already in the embedded Python in Mercurial.
I noticed that I had snuck in a new (though unused) 'urls' function into this patch. I've removed it. (It's no longer necessary in the patch that it properly belonged to.)
Attachment #656084 - Flags: review?(josh)
Attachment #646775 - Attachment is obsolete: true
Attachment #646775 - Flags: review?(josh)
Comment on attachment 656084 [details] [diff] [review]
Break bzexport down into individual files in an initial attempt at making some reusable pieces

Review of attachment 656084 [details] [diff] [review]:
-----------------------------------------------------------------

I admit that I did not look too carefully at this. It looks fairly sensible to me.

::: bzexport.py
@@ +802,5 @@
>              bug = result['id']
>              ui.write("Created bug %s at %s\n" % (bug, bugzilla + "/show_bug.cgi?id=" + bug))
>          except Exception, e:
> +            #raise util.Abort(_("Error creating bug: %s\n" % str(e)))
> +            raise

Any particular reason for this change?
Attachment #656084 - Flags: review?(josh) → review+
(In reply to Josh Matthews [:jdm] from comment #6)
> Comment on attachment 656084 [details] [diff] [review]
> ::: bzexport.py
> @@ +802,5 @@
> >              bug = result['id']
> >              ui.write("Created bug %s at %s\n" % (bug, bugzilla + "/show_bug.cgi?id=" + bug))
> >          except Exception, e:
> > +            #raise util.Abort(_("Error creating bug: %s\n" % str(e)))
> > +            raise
> 
> Any particular reason for this change?

Whoops, debugging.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Product: Other Applications → Developer Services
You need to log in before you can comment on or make changes to this bug.