Best practices for using mercurial within web2py

72 views
Skip to first unread message

Mark Graves

unread,
Feb 21, 2014, 10:28:20 PM2/21/14
to web...@googlegroups.com
Hey everyone,

I'm trying to use web2py to manage multiple repos on my local system.

I know using os.chdir is a problem.

Is the best way to just hg clone [REPO_URL] [FULL_PATH_TO_FILES]?

Also, relatedly, I was trying to restart apache from within a web2py app.  That was giving me errors, so I'm doing something else.  Is there a way to do this?

If this all works, I should have a nice (hopefully) open source app for this process soon.

Thanks 

Mark

Calvin Morrison

unread,
Feb 21, 2014, 10:47:31 PM2/21/14
to web...@googlegroups.com
> Also, relatedly, I was trying to restart apache from within a web2py app.
> That was giving me errors, so I'm doing something else. Is there a way to
> do this?

you can do it from the shell. Look up your relevant distro information
on init scripts.

usually it's something like

sudo service apache2 restart

Mark Graves

unread,
Feb 21, 2014, 10:55:13 PM2/21/14
to web...@googlegroups.com
Right.  I know the commands.  But is there an issue restarting apache from within web2py (which is running on apache)?

I was getting some errors when i ran the commands from within web2py vs shell



--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/KbUVnZTLlEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dave S

unread,
Feb 27, 2014, 4:12:19 PM2/27/14
to web...@googlegroups.com
On Friday, February 21, 2014 7:28:20 PM UTC-8, Mark Graves wrote:
Hey everyone,

I'm trying to use web2py to manage multiple repos on my local system.

I know using os.chdir is a problem.

Is the best way to just hg clone [REPO_URL] [FULL_PATH_TO_FILES]?


 I'm not sure what you mean by "manage multiple repos" ... are you trying to use w2p as a front-end for mecurial?  Are you wanting to browse the repos and/or push/pull? Mercurial has its own web-server that would run directly under apache (it also has a lighter web-server which is mostly used for temporary intranet sharing, AIUI).

If you are trying to front the repos from web2py, perhaps you want to investigate the command server that mercurial provides.

If I'm off-track on what you want to do, perhaps you could gives us a more precise description.

/dps

Mark Graves

unread,
Feb 28, 2014, 12:27:50 PM2/28/14
to web...@googlegroups.com
Thanks for the replies.

I am using web2py as a front end for bitbucket and mercurial.  Mercurial is managing multiple repos on my site.  I click a button to pull new code in from bitbucket.

The way I am currently doing it is passing a path into a subprocess which runs mercurial commands to do the pulls and updates.

I did this to avoid os.chdir() (for thread safety) ... 

Is it better to use the mercurial python api?

Anyone have any experience with this?

Mark


Dave S

unread,
Feb 28, 2014, 1:37:09 PM2/28/14
to web...@googlegroups.com


On Friday, February 28, 2014 9:27:50 AM UTC-8, Mark Graves wrote:
Thanks for the replies.

I am using web2py as a front end for bitbucket and mercurial.  Mercurial is managing multiple repos on my site.  I click a button to pull new code in from bitbucket.

The way I am currently doing it is passing a path into a subprocess which runs mercurial commands to do the pulls and updates.

I did this to avoid os.chdir() (for thread safety) ... 

Is it better to use the mercurial python api?


I know the hg people do not recommend the python interface, they recommend the command server or passing the same commands as you'd use in a terminal interface.  The command server gives you  performance close to the internal calls, and there may be a python flavor of it.   However, it may not make sense if you can't keep the connection open, and I'm not sure how web2py would deal with that in a non-DAL situation.

The internal API, unlike the user-visible commands and the command server, is not guaranteed to be consistent from release to release.  Bundled extensions are guaranteed to be updated to match; third-party extensions need to be watching for the RC candidates.

/dps


Reply all
Reply to author
Forward
0 new messages