Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve submodule messages / git hooks #3275

Merged
merged 11 commits into from May 9, 2013
Merged

Conversation

minrk
Copy link
Member

@minrk minrk commented May 3, 2013

A much less intrusive version of #3274 that has effect on checkout / pull / merge, rather than setup.py. It does require a user install step, because you cannot add active hooks to a repo.

A much less intrusive version of ipython#3274 that has effect on checkout / pull / merge,
rather than setup.py.  It does require a user install step,
because you cannot add active hooks to a repo.
@ellisonbg
Copy link
Member

There is a balance here. One one hand I want us to make things easy for people running from git. OTOH, I think it is appropriate to ask people to start to become aware of how submodules work. I don't like how this PR hides submodules from everyone and requires a very manual install step (python setup.py submodule is much easier...).

@ellisonbg
Copy link
Member

Oh, I wanted to ping @fperez on this PR...

@minrk
Copy link
Member Author

minrk commented May 3, 2013

This PR doesn't hide anything from anyone - it adds hooks that users may use in order to make git pull and git checkout more sensible. One cannot add git hooks that will actually be on by default.

@ellisonbg
Copy link
Member

OK i understand - these are optional - I guess all I mean then is that I think that the setup.py stuff should still be there...

@minrk
Copy link
Member Author

minrk commented May 3, 2013

had lunch with @fperez, and I think we are converging on a middle-ground:

  • setup.py anything with missing components should update (unambiguous, current behavior of master)
  • setup.py anything with unclean components should error, asking the user to update submodules
  • starting the notebook with unclean components should warn - mainly for setupegg.py develop people

This way, we never touch the git state on the user's behalf (except in the unambiguous case that components doesn't exist), but users should get reasonable information when their state is unclean.

@ellisonbg
Copy link
Member

Great, I think that sounds very reasonable.

On Fri, May 3, 2013 at 2:13 PM, Min RK notifications@github.com wrote:

had lunch with @fperez https://github.com/fperez, and I think we are
converging on a middle-ground:

  • setup.py anything with missing components should update(unambiguous, current behavior of master)
  • setup.py anything with unclean components should error, asking the
    user to update submodules
  • starting the notebook with unclean components should warn - mainly
    for setupegg.py develop people

This way, we never touch the git state on the user's behalf (except in the
unambiguous case that components doesn't exist), but users should get
reasonable information when their state is unclean.


Reply to this email directly or view it on GitHubhttps://github.com//pull/3275#issuecomment-17418592
.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

minrk added 7 commits May 3, 2013 15:33
`setup.py anything` will halt with an informative error
if the submodules are unclean.

It will fetch the submodules if they are entirely absent.

Nothing will happen if it is not a git repo.
shows a warning (not an error) if components are out of date.
the asctime datefmt is also configurable now
datefmt no longer necessary
@minrk
Copy link
Member Author

minrk commented May 4, 2013

I've also tweaked logging so that messages at level WARNING or above get the level name in the message. The one thing I don't like about this is that our --existing message uses the 'CRITICAL' log level, to ensure it gets printed. I do not think this is really appropriate. What do people think about switching the log level of the --existing message to INFO and/or switching it to plain io.rprint?

@minrk
Copy link
Member Author

minrk commented May 4, 2013

I've demoted the message to logging.info, and added rprint for the rare case that there is no initial parent process.

def update_submodules(repo_dir):
"""update submodules in a repo"""
subprocess.Popen("git submodule init", cwd=repo_dir, shell=True)
subprocess.Popen("git submodule update", cwd=repo_dir, shell=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to wait here? Also, why use shell=True?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant it to be check_call, not Popen, that's why there's no wait on the
end. That's fixed. The shell=True was following pattern already set by
previous git subprocess calls in setupbase, I do not know if they are
necessary - one logical reason is that it can have PATH ramifications.

On Mon, May 6, 2013 at 5:51 PM, Takafumi Arakaki
notifications@github.comwrote:

In IPython/utils/submodule.py:

  • )
  • status, _ = proc.communicate()
  • status = status.decode("ascii")
  • for line in status.splitlines():
  •    if status.startswith('-'):
    
  •        return 'missing'
    
  •    elif status.startswith('+'):
    
  •        return 'unclean'
    
  • return 'clean'

+def update_submodules(repo_dir):

  • """update submodules in a repo"""
  • subprocess.Popen("git submodule init", cwd=repo_dir, shell=True)
  • subprocess.Popen("git submodule update", cwd=repo_dir, shell=True)

No need to wait here? Also, why use shell=True?


Reply to this email directly or view it on GitHubhttps://github.com//pull/3275/files#r4105107
.

@@ -673,11 +670,23 @@ def _signal_stop(self, sig, frame):
def _signal_info(self, sig, frame):
print self.notebook_info()

def init_components(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am -1 on having this logic in the bas application class. This class is used by other projects and we eventually want to separate out this our base config/app code from our repo so other projects can use it. I know you and @fperez spent time talking about the best approach here, but I am not thrilled about putting logic into the running of ipython to manage our git repo...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't do anything if IPython is run from any circumstances other than the IPython git repo (that is, ipython_package_dir/.. must be a git repo for this to have any effect. If IPython is installed, all this does is check that components exists and returns.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the components submodule will follow this class wherever it goes, so I don't see how there could be a problem. The only way anyone could have a problem is if they copied this class to somewhere rather than subclassing it, and didn't make any appropriate changes (which would make no sense).

@takluyver
Copy link
Member

It's worth noting that tarballs/zipballs downloaded from Github don't have the components submodule, so you can't run the notebook from those any more. Possibly we should give the user some sort of hint even if it's not run from a git repository. Then again, we don't want it to complain when, say, Debian packaging moves the static files out to /usr/share.

@minrk
Copy link
Member Author

minrk commented May 7, 2013

That's a good point. I pinged GitHub about that last week, and the tarballs are created via git archive, which doesn't support submodules. If submodule support ever arrives in git archive, then GitHub tarballs will be complete.

@takluyver
Copy link
Member

OK, I think it's fine to leave that for now, then.

On 7 May 2013 22:06, Min RK notifications@github.com wrote:

That's a good point. I pinged GitHub about that last week, and the
tarballs are created via git archive, which doesn't support submodules.
If submodule support ever arrives in git archive, then GitHub tarballs
will be complete.


Reply to this email directly or view it on GitHubhttps://github.com//pull/3275#issuecomment-17570671
.

@ellisonbg
Copy link
Member

This looks good, merging.

ellisonbg added a commit that referenced this pull request May 9, 2013
improve submodule messages / git hooks
@ellisonbg ellisonbg merged commit 5acb5e3 into ipython:master May 9, 2013
@minrk minrk deleted the submodule-hooks branch March 31, 2014 23:36
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
improve submodule messages / git hooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants