首页 \ 问答 \ Mercurial:我可以忽略文件的推/拉但仍然提交?(Mercurial: can I ignore a file for push/pull but still commit? (.hgsub))

Mercurial:我可以忽略文件的推/拉但仍然提交?(Mercurial: can I ignore a file for push/pull but still commit? (.hgsub))

我有一个回购,有两个子回购设置如下:

project/
   |-- folder1
   |-- folder2
   |-- www       [subrepo]
   |-- dev       [subrepo]

在机器A上,我检查了项目,www和dev,并修改了.hgsub。 我必须提交这个以便www和dev子存储库被hg(commit -S等)识别。

但是机器B只使用项目的www功能,所以它看起来像这样:

project/
   |-- folder1
   |-- folder2
   |-- www       [subrepo]

同样,机器B中的.hgsub只有一个www的条目,我必须为hg提交它以将其识别为子参数。

我想做的是按下并拉到我的中央仓库,但不要推/拉.hgsub。 否则,如果我提交并从机器A推送.hgsub,然后从机器B拉出,我会自动获得dev subrepo以及我不想要的www subrepo。

所以我在机器B上再次修改.hgsub只有www并提交它才能生效。 我在机器B上的www子程序中做了一些工作,想要推回到中央仓库,但它也会将更改推送到.hgsub。 现在,当我拉上机器A时,我的“dev”subrepo消失了,我必须再次将它添加回.hgsub,然后我这样来回走,直到我沮丧地拔出头发。

有没有办法解决这个问题? 必须在每台机器上本地提交.hgsub才能使子实例工作,但我不希望它们被推或拉。 推/拉是否有.hgignore?

干杯。


I have a repo with two sub-repos set up like this:

project/
   |-- folder1
   |-- folder2
   |-- www       [subrepo]
   |-- dev       [subrepo]

On Machine A, I have checked out project, www, and dev, and modified .hgsub as such. I have to commit this in order for the www and dev subrepositories to be recognised by hg (commit -S, etc).

However Machine B only uses the www functionality of the project, so it looks like this:

project/
   |-- folder1
   |-- folder2
   |-- www       [subrepo]

Again, the .hgsub in Machine B only has an entry for www, and I have to commit this for hg to recognise it as a subrepo.

What I'd like to do is do push and pull to my central repo but NOT push/pull the .hgsub. Otherwise, if I commit and push .hgsub from Machine A say, and then pull from Machine B, I automatically get the dev subrepo as well as the www subrepo that I don't want.

So I modify .hgsub again on Machine B to only have www and commit it for it to take effect. I do some work in the www subrepo on Machine B and want to push back out to the central repo, but it will also push out the change to .hgsub. Now when I pull on Machine A, my 'dev' subrepo is gone and I have to add it back to .hgsub again, and I go back and forth like this until I pull my hair out in frustration.

Is there any way to get around this? .hgsub must be locally committed on each machine in order for the subrepos to work, but I don't want them to be pushed or pulled. Is there a .hgignore for push/pull?

cheers.


原文:https://stackoverflow.com/questions/7198934
更新时间:2022-04-18 06:04

最满意答案

std::vector::push_back不是线程安全的,你不能在没有任何针对来自多个线程的竞争条件的保护的情况下调用它。

相反,准备向量使其大小已经正确,然后通过operator[]插入元素。

或者,您可以使用关键区域保护插入:

#pragma omp critical
B.push_back(A);

这样一次只有一个线程会进行插入,这将修复错误但会减慢代码速度。

总的来说,我认为你不会以正确的方式处理并行化,但如果没有更清晰,更具代表性的问题描述,就没有办法提供更好的建议。


std::vector::push_back is not thread safe, you cannot call that without any protection against race conditions from multiple threads.

Instead, prepare the vector such that it's size is already correct and then insert the elements via operator[].

Alternatively you can protect the insertion with a critical region:

#pragma omp critical
B.push_back(A);

This way only one thread at a time will do the insertion which will fix the error but slow down the code.

In general I think you don't approach parallelization the right way, but there is no way to give better advise without a clearer and more representative problem description.

相关问答

更多
  • 你的代码包含竞争条件 。 冲突的陈述是赋值a[i+1] = b[i]; 写入数组a和语句totalA += a[i]; 从a读取。 在您的代码中,不能保证负责写入数组中特定位置的迭代在从该位置读取的迭代之前执行。 为了进一步说明问题,订购包含冲突语句的循环段可以解决问题(但对您的性能来说很可能是破坏性的): #pragma omp parallel for ordered reduction(+:totalA) for (int i = 0; i < 1000000; i++) { if ( ...
  • std::vector::push_back不是线程安全的,你不能在没有任何针对来自多个线程的竞争条件的保护的情况下调用它。 相反,准备向量使其大小已经正确,然后通过operator[]插入元素。 或者,您可以使用关键区域保护插入: #pragma omp critical B.push_back(A); 这样一次只有一个线程会进行插入,这将修复错误但会减慢代码速度。 总的来说,我认为你不会以正确的方式处理并行化,但如果没有更清晰,更具代表性的问题描述,就没有办法提供更好的建议。 std::vector: ...
  • 当您使用private作为变量时,私有副本开始时没有值,我的意思是它当时没有初始化。 因此,参数传递的值不设置set_ variable。 您需要使用firstprivate ,它首先使用当前值初始化私有副本。 When you use private for a variable a private copy starts with no value, I mean it is not initialized at that time. Therefore, the value passed by par ...
  • 最后一步 - 仅对最内层循环进行并行化(假设根据之前的结果,这将是最快的情况)(2个内核) 但是(惊喜!)所用的时间是: about 11 s 这并不令人意外。 并行块执行隐式障碍,甚至可以加入和创建线程(某些库可能使用线程池来降低线程创建的成本)。 最后,开放平行区域很昂贵。 你应该尽可能少地做到这一点。 线程将同时并行运行外部循环,但是一旦它们到达块的omp for就会分割迭代空间,所以结果应该仍然是正确的(如果不确定,应该让程序检查它)。 为了测试性能,您应该始终运行您的实验来转换编译器优化,因为它 ...
  • 如果j仅用于循环范围,我会执行以下操作: [...] unsigned int i; #pragma omp parallel for for(i = 0; i < num1; ++i) { unsigned int j = i % num2; a[j] = do_compute(j); } [...] 不要试图在这里挑剔,但鉴于do_compute是确定性的并且没有副作用,你最好只使用 [...] unsigned int i; #pragma omp parallel for for( ...
  • 我没有执行难以分发的while循环,而是提出以下建议:在数组索引上使用循环。 我想你想在数组zeta_list生成随机样本。 我在平行循环中移动了一会儿。 不过,请注意您需要一个“支持OpenMP”的PRNG。 在最近的gfortran版本中就是这种情况,我不知道其他编译器。 我还将1.0_16更改为aa 1.0d0因为固定的数字常量不是一般指定kind参数并减小静态数组大小的好方法。 PROGRAM RANDOM_DISTRIBUTION IMPLICIT NONE DOUBLE PRECI ...
  • Qt没有问题。 你不能在使用openMP并行化的循环中休息。 这背后的推理:假设你有一个包含10次迭代的循环。 现在,你想在迭代5中打破循环。你说, if (iteration==5) break; 现在进入并行上下文,您已经创建了10个线程,并且每个线程并行执行各自的迭代。 因此,当thread5达到某个条件时,您需要所有其他线程 确定这个 撤消他们的输出 不再处理迭代 动态执行此操作并执行所有不同的调度策略。 正如您所看到的,在大多数情况下这是不可行/不实用的。 因此,OpenMP不允许在并 ...
  • 所以,你知道通过查看存在负载平衡问题的代码,IMO你应该用schedule(static,1)进行测试,以保证你在线程之间有最小的负载平衡(最多只有一次迭代)。 比计划(动态,1)比较并验证使用动态(动态具有内部锁定机制)的开销是否被平衡线程间工作的收益所淹没。 如果你仔细检查内环的工作就像一个三角形(N = SIZE): *k/i 0 1 2 3 4 5 ... N-1 * 0 - x x x x x ... x * 1 - - x x x x ... x * 2 - - - x x x ...
  • 假设代码工作,您可以进行以下一些改进: int m = 101; double e = 10; double A[m][m], B[m][m]; #pragma omp parallel num_threads(2) shared(A, B) { #pragma omp for for (int x=0; x
  • 我认为你不需要开关和我: locations = [23424977,2459115, 2487956] onoff = [1,2] for switch in onoff: for location in locations: if onoff == 1: trends1 = api.trends_place(location,include='hashtags') else: trends1 = api.tren ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)