代码之家  ›  专栏  ›  技术社区  ›  Sergii Tanchenko

在所有子目录上运行hg pull

  •  4
  • Sergii Tanchenko  · 技术社区  · 7 年前

    如何从共享父目录更新多个mercurial(hg)存储库?

    /plugins/search
    /plugins/overview
    /plugins/chart
    

    我想将一个分支更改为默认分支,并一次性更新它们

    cd /plugins/search
    hg update -C default
    hg pull -u
    
    3 回复  |  直到 7 年前
        1
  •  2
  •   Sergii Tanchenko    7 年前

    从父目录运行以下命令, plugins 在这种情况下:

    find . -type d -maxdepth 1 -exec hg update -C default -R {} \;
    find . -type d -maxdepth 1 -exec hg pull -u -R {} \;
    

    为了澄清:

    • find . 搜索当前目录
    • -type d 查找目录而不是文件
    • -maxdepth 1 对于一个子目录的最大深度
    • -exec {} \; 为每个查找运行自定义命令
    • hg update -C default -R {} hg将每个存储库中的分支更改为默认
    • hg pull -u -R {} 如果在每个存储库中提取了变更集,hg将更新到新的分支负责人
        2
  •  1
  •   Community CDub    4 年前

    在目录树中查找更深的存储库

    find . -type d -iname .hg -exec echo \; -exec hg pull -u -R {}/.. \;
    

    首字母 -exec echo \; 只有保持输出清洁。

    点击此处查看 more find galore .

        3
  •  0
  •   Pramod Lawate    3 年前

    在项目的根目录上运行此命令,该目录为 插件

    查找-maxdepth 1-type d-print-execdir git-git dir={}/。git——工作树=$PWD/{}pull-origin-develop;