#4556 Repo success/failure emails reference wrong project & mount point

v1.0.0
closed
nobody
42cc (432)
SCM
2015-08-20
2012-07-16
No

In Allura/allura/tasks/repo_tasks.py there are 3 emails sent for success/failure during clone(). The emails show the wrong destination project & mount point. They show the original project & mount point instead of the destination.

If init_as_clone or some other logic is changing the current c.app and c.project and not resetting it, it would be good to use the h.push_context context manager, so it is reset at the end. Another good option is to explicitly pass app & project as parameters, and not use the global c versions.

Related

Tickets: #4556

Discussion

  • Yaroslav Luzin - 2012-07-17

    created #122: [#4556] Repo success/failure emails reference wrong project & mount point (1cp)

    • status: open --> in-progress
     

    Related

    Tickets: #4556

  • Igor Bondarenko - 2012-07-17

    I found out that clone() uses destination mount point (as needed) but source project.

    It happens because clone() get called using h.push_config context manager which explicitly sets up c.project to source project.

    Calling clone() without h.push_config works for me (c.project points to destination project). I made the following changes:

    diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
    index ae229ca..ff5c0bc 100644
    --- a/ForgeGit/forgegit/git_main.py
    +++ b/ForgeGit/forgegit/git_main.py
    @@ -54,12 +54,11 @@ def install(self, project):
             cloned_from_repo_id = self.config.options.get('cloned_from_repo_id')
             init_from_url = self.config.options.get('init_from_url')
             if cloned_from_project_id is not None:
    -            with h.push_config(c, project=M.Project.query.get(_id=cloned_from_project_id)):
    -                cloned_from = GM.Repository.query.get(_id=cloned_from_repo_id)
    -                allura.tasks.repo_tasks.clone.post(
    -                    cloned_from_path=cloned_from.full_fs_path,
    -                    cloned_from_name=cloned_from.app.config.script_name(),
    -                    cloned_from_url=cloned_from.full_fs_path)
    +            cloned_from = GM.Repository.query.get(_id=cloned_from_repo_id)
    +            allura.tasks.repo_tasks.clone.post(
    +                cloned_from_path=cloned_from.full_fs_path,
    +                cloned_from_name=cloned_from.app.config.script_name(),
    +                cloned_from_url=cloned_from.full_fs_path)
             elif init_from_url:
                 allura.tasks.repo_tasks.clone.post(
                     cloned_from_path=None,
    diff --git a/ForgeHg/forgehg/hg_main.py b/ForgeHg/forgehg/hg_main.py
    index bb6d93d..6db6cc9 100644
    --- a/ForgeHg/forgehg/hg_main.py
    +++ b/ForgeHg/forgehg/hg_main.py
    @@ -54,12 +54,11 @@ def install(self, project):
             cloned_from_repo_id = self.config.options.get('cloned_from_repo_id')
             init_from_url = self.config.options.get('init_from_url')
             if cloned_from_project_id is not None:
    -            with h.push_config(c, project=M.Project.query.get(_id=cloned_from_project_id)):
    -                cloned_from = HM.Repository.query.get(_id=cloned_from_repo_id)
    -                allura.tasks.repo_tasks.clone.post(
    -                    cloned_from_path=cloned_from.full_fs_path,
    -                    cloned_from_name=cloned_from.app.config.script_name(),
    -                    cloned_from_url=cloned_from.full_fs_path)
    +            cloned_from = HM.Repository.query.get(_id=cloned_from_repo_id)
    +            allura.tasks.repo_tasks.clone.post(
    +                cloned_from_path=cloned_from.full_fs_path,
    +                cloned_from_name=cloned_from.app.config.script_name(),
    +                cloned_from_url=cloned_from.full_fs_path)
             elif init_from_url:
                 allura.tasks.repo_tasks.clone.post(
                     cloned_from_path=None,
    

    Is it suitable fix or I missed something?
    If this is enough I'll push changes to the repo.

     
  • Dave Brondsema

    Dave Brondsema - 2012-07-17

    If that fixes the problem, it looks good to me. You can test the behavior by forking a repo and choosing to put it into a different project.

     
  • Yaroslav Luzin - 2012-07-18

    closed #122, the fix is in 42cc_4556 branch

    • status: in-progress --> code-review
     
  • Dave Brondsema

    Dave Brondsema - 2012-07-18
    • status: code-review --> closed
    • milestone: forge-backlog --> forge-jul-27

    • labels: --> 42cc

    • qa: Dave Brondsema
     

Log in to post a comment.