(CommandList
  children: [
    (C {(set)} {(-e)})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:SOURCE_DIR) op:Equal rhs:{(/var/hg/source)} spids:[29])]
      spids: [29]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:INSTALL_DIR)
          op: Equal
          rhs: {(/var/hg/install)}
          spids: [32]
        )
      ]
      spids: [32]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:REPOS_DIR) op:Equal rhs:{(/var/hg/repos)} spids:[35])]
      spids: [35]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:HTDOCS_DIR) op:Equal rhs:{(/var/hg/htdocs)} spids:[38])]
      spids: [38]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(${ VSub_Name SOURCE_DIR)} {(Lit_Other "]")})
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Mercurial source not available at ") (${ VSub_Name SOURCE_DIR))})
            (C {(echo)} {(DQ ("You need to mount a volume containing the Mercurial source code"))})
            (C {(echo)} {(DQ ("when running the container. For example:"))})
            (C {(echo)} {(DQ )})
            (C {(echo)} 
              {
                (DQ ("  ") (Lit_Other "$") (" docker run -v ~/src/hg:/") (${ VSub_Name SOURCE_DIR) 
                  (" hg-apache")
                )
              }
            )
            (C {(echo)} {(DQ )})
            (C {(echo)} {(DQ ("This container will now stop running."))})
            (C {(exit)} {(1)})
          ]
          spids: [-1 57]
        )
      ]
      spids: [-1 120]
    )
    (C {(echo)} 
      {
        (DQ ("Installing Mercurial from ") (${ VSub_Name SOURCE_DIR) (" into ") 
          (${ VSub_Name INSTALL_DIR)
        )
      }
    )
    (C {(pushd)} {(${ VSub_Name SOURCE_DIR)})
    (C {(/usr/bin/python2.7)} {(setup.py)} {(install)} {(--root) (Lit_Other "=") (/)} 
      {(--prefix) (Lit_Other "=") (${ VSub_Name INSTALL_DIR)} {(--force)}
    )
    (C {(popd)})
    (C {(mkdir)} {(-p)} {(${ VSub_Name HTDOCS_DIR)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {(KW_Bang "!")} {(-f)} {(${ VSub_Name HTDOCS_DIR) (/config)} 
                  {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [(C {(cp)} {(/defaulthgwebconfig)} {(${ VSub_Name HTDOCS_DIR) (/config)})]
          spids: [-1 191]
        )
      ]
      spids: [-1 203]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {(KW_Bang "!")} {(-f)} {(${ VSub_Name HTDOCS_DIR) (/hgweb.wsgi)} 
                  {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir
                  op_id: Redir_DGreat
                  fd: -1
                  arg_word: {(${ VSub_Name HTDOCS_DIR) (/hgweb.wsgi)}
                  spids: [227]
                )
                (HereDoc
                  op_id: Redir_DLess
                  fd: -1
                  body: 
                    {
                      (DQ ("config = '") (${ VSub_Name HTDOCS_DIR) ("/config'\n") ("\n") ("import sys\n") 
                        ("sys.path.insert(0, '") (${ VSub_Name INSTALL_DIR) ("/lib/python2.7/site-packages')\n") ("\n") 
                        ("from mercurial import demandimport\n") ("demandimport.enable()\n") ("\n") ("from mercurial.hgweb import hgweb\n") 
                        ("application = hgweb(config)\n")
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [234]
                )
              ]
            )
          ]
          spids: [-1 222]
        )
      ]
      spids: [-1 256]
    )
    (C {(mkdir)} {(-p)} {(${ VSub_Name REPOS_DIR)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(${ VSub_Name REPOS_DIR) (/repo)} 
                  {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (C {(${ VSub_Name INSTALL_DIR) (/bin/hg)} {(init)} {(${ VSub_Name REPOS_DIR) (/repo)})
            (C {(chown)} {(-R)} {(www-data) (Lit_Other ":") (www-data)} 
              {(${ VSub_Name REPOS_DIR) (/repo)}
            )
          ]
          spids: [-1 284]
        )
      ]
      spids: [-1 313]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {(KW_Bang "!")} {(-f)} {(TildeSubPart prefix:"") (/.hgrc)} 
                  {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir
                  op_id: Redir_DGreat
                  fd: -1
                  arg_word: {(TildeSubPart prefix:"") (/.hgrc)}
                  spids: [338]
                )
                (HereDoc
                  op_id: Redir_DLess
                  fd: -1
                  body: {(DQ ("[ui]\n") ("username = Dummy User <nobody@example.com>\n"))}
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [343]
                )
              ]
            )
          ]
          spids: [-1 333]
        )
      ]
      spids: [-1 349]
    )
    (C {(echo)} {(DQ ("Verifying Mercurial installation looks happy"))})
    (C {(${ VSub_Name INSTALL_DIR) (/bin/hg)} {(debuginstall)})
    (C {(.)} {(/etc/apache2/envvars)})
    (C {(echo)} {(DQ ("Starting Apache HTTP Server on port 80"))})
    (C {(echo)} {(DQ ("We hope you remembered to publish this port when running the container!"))})
    (C {(echo)} {(DQ ("If this is an interactive container, simply CTRL^C to stop."))})
    (C {(exec)} {(DQ ($ VSub_At "$@"))})
  ]
)