doStuff :: String
          -> Options
          -> IO ()
  doStuff oldname opts = do
    when (optVerbose opts) $ updateGlobalLogger "hgc" (setLevel DEBUG)
    Cvmfs.inTransaction repository publish $ do
      capsuleLoc <- if (amend) then 
          return $ repositoryLoc </> oldname
        else 
          copyCapsule oldname newname repositoryLoc
      debugM "hgc" $ "Capsule location: " ++ capsuleLoc
      tmpConfig <- updateConfig newname capsuleLoc opts
      debugM "hgc" $ "Config location: " ++ tmpConfig
      unless (optCloneOnly opts) $ Lxc.startConsole newname tmpConfig
      cleanCapsule capsuleLoc
    where
      repository = optRepository opts
      publish = optPublish opts
      amend = optAmend opts
      repositoryLoc = Cvmfs.base </> repository
      newname = if amend then oldname else capsuleName oldname opts


  -- TODO: replace with regex?
doStuff :: String
          -> Options
          -> IO ()
doStuff oldname opts = do
    when (optVerbose opts) $ updateGlobalLogger "hgc" (setLevel DEBUG)
    Cvmfs.inTransaction repository publish $ do
      capsuleLoc <- if (amend) then 
          return $ repositoryLoc </> oldname
        else 
          copyCapsule oldname newname repositoryLoc
      debugM "hgc" $ "Capsule location: " ++ capsuleLoc
      tmpConfig <- updateConfig newname capsuleLoc opts
      debugM "hgc" $ "Config location: " ++ tmpConfig
      unless (optCloneOnly opts) $ Lxc.startConsole newname tmpConfig
      cleanCapsule capsuleLoc
    where
      repository = optRepository opts
      publish = optPublish opts
      amend = optAmend opts
      repositoryLoc = Cvmfs.base </> repository
      newname = if amend then oldname else capsuleName oldname opts


  -- TODO: replace with regex?
doStuff oldname opts = do
    when (optVerbose opts) $ updateGlobalLogger "hgc" (setLevel DEBUG)
    Cvmfs.inTransaction repository publish $ do
      capsuleLoc <- if (amend) then 
          return $ repositoryLoc </> oldname
        else 
          copyCapsule oldname newname repositoryLoc
      debugM "hgc" $ "Capsule location: " ++ capsuleLoc
      tmpConfig <- updateConfig newname capsuleLoc opts
      debugM "hgc" $ "Config location: " ++ tmpConfig
      unless (optCloneOnly opts) $ Lxc.startConsole newname tmpConfig
      cleanCapsule capsuleLoc
    where
      repository = optRepository opts
      publish = optPublish opts
      amend = optAmend opts
      repositoryLoc = Cvmfs.base </> repository
      newname = if amend then oldname else capsuleName oldname opts


  -- TODO: replace with regex?