Android Studio - 无法从 SVN 分支合并 [英] Android Studio - unable to merge from SVN branch

查看:40
本文介绍了Android Studio - 无法从 SVN 分支合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们决定遵循为我们添加到移动应用程序的每个新功能创建一个新的 SVN 分支的过程.这背后的最终目标是保留每个代码更改的历史记录(当我们手动将项目文件夹复制到 SVN 而不是创建 & 合并分支时,这不会发生).

我的问题是到目前为止我无法将更改从一个分支合并到另一个.

我已经引用了以下帖子但没有成功:

  • 我想将分支Feature_A3 中的更改合并到分支Feature_A2.为此,我使用了 A2 工作副本中 Android Studio 的 VCS 中的 Merge from 选项:

    然后要求我选择要从 (A3) 合并的分支或配置其他分支:

    我点击配置分支,只是为了向您展示现有的分支配置:

    如您所见,A2 是 Trunk,A3 是 Branch.这是正确的吗?

    然后它会问我想合并到 A2 的 A3 的哪一部分.我选择 /src 目录(其中存在相关更改):

    然后它慷慨地给了我三种不同的方式来执行合并操作:

    我选择第三个选项,因为它直接给了我需要合并的更改:

    我点击Merge SelectedBAM!!!我每次都收到这个错误:

    没有关于未解决的冲突"或跳过的项目"是什么的线索.为什么我会收到这个错误,我应该怎么做才能将 A3 中的更改合并到 A2 中???有人可以帮忙吗?所有的答案将不胜感激.谢谢...

    我一直在关注以下 Intellij IDEA 官方文档:

    请注意:

    • 目前我使用的是 Subversion,而不是 Git.

    • 我本地工作副本的目录结构不完全是与 SVN 存储库相同.这可能是错误的原因吗?

    答案...

    感谢 彼得·帕克,尤其是 Yoav Aharoni 的宝贵意见.正如 Yoav 正确指出的那样,这确实是指定分支位置文件夹的方式.它需要是包含分支的文件夹,而不是分支文件夹本身:正如 Peter 所说的那样,选中包括合并的修订"会显示合并的历史记录.我现在可以从 IDE 内部进行合并,并在 TortoiseSVN 中查看合并的历史记录.没有命令行!YAY!!!

    然而,最后一个问题是我无法在 Android Studio (Intellij IDEA) 中查看合并的历史记录,如 查看合并源.有谁知道如何在 Android Studio 中实现这一点?

    解决方案

    呸,好久没用 SVN... :)

    但据我所知,Branch Locations 应该是包含您的分支文件夹(而不是每个单独的分支文件夹)的文件夹.

    您看,通常 SVN 存储库遵循标准命名约定和文件夹结构:

    trunk/分行/功能_A2/功能_A3/标签/v1.01/v1.02/等等...

    trunk 是主要开发发生的地方,branch 用于功能、长期或有风险的项目,或用于不同阶段(例如 QA 和预产品).

    因此,据我所知,Android Studio 希望您将 Branch Locations 设置为 branches 文件夹.在你的情况下,我认为它应该是 http://192.168.0.64/svn/.../Android/Feature.

    此外,您的 trunk 不是 Feature_A2 - Feature_A2 只是另一个分支.
    虽然看不到内容,但我觉得http://192.168.0.64/svn/.../Android/Development 可能是你的后备箱.

    这应该不会打扰您,因为您不必合并到主干,您也可以在分支之间合并(例如,将 Feature_A3 合并到 Feature_A2).

    所以,回顾一下:

    1. 虽然不是强制性的,但我建议重命名您的文件夹以匹配约定(您可以通过在 Tortoise SVN 中右键单击轻松实现,但只有在所有队友提交后才能进行,否则合并对他们来说将是一场地狱).
    2. 尝试将分支位置设置为http://192.168.0.64/svn/.../Android/Feature
    3. Trunkhttp://192.168.0.64/svn/.../Android/Development(仅当它确实包含源代码时,类似于 Feature_A2/3)
    4. 考虑在 tags 文件夹中标记"你的发布(这几乎只是将主干/分支文件夹复制到标签,但你有一个命令).

      如果这样做,您还可以将 tags 文件夹添加到 Branch Locations,这样您就可以将当前的源代码与任何以前的版本(其中很方便).

    P.S:未解决的冲突"错误 也可能意味着您有未解决的冲突(废话:)).当您和队友更改文件中的相同行(或者如果他删除了您更改的文件)并且您更新以获取他的更改时,通常会产生冲突.

    除非您手动解决这些冲突/更改,否则 SVN 不会让您合并.

    您可以在底部的 Version Control 标签中找到冲突,它们会被标记为红色.
    (但我认为这不是你的问题)


    如果这对您有用,请告诉我!

    We have decided to follow the process of creating a new SVN branch for every new feature that we add to our mobile app. The ultimate goal behind this is to preserve the history for every single code change (this doesn't happen when we manually copy project folders into SVN instead of creating & merging branches).

    My problem is that so far I am unable to merge changes from one branch to another.

    I have already referred the following posts without success:

    Here is what I have tried so far:

    I have two feature branches as can be seen below in Tortoise SVN:

    I want to merge the changes in the branch Feature_A3 into branch Feature_A2. To do this, I am using the Merge from option in Android Studio's VCS from the A2 working copy:

    It then asks me to select the branch to merge from (A3) or configure other branches:

    I click on Configure Branches, just to show you the existing branch config:

    As you can see, A2 is the Trunk and A3 is the Branch. Is this correct?

    It then asks me what part of A3 I want to merge into A2. I select the /src directory (where the relevant changes are present):

    It then generously gives me three different ways to perform the merge operation:

    I select the third option as it directly gives me the changes I need to merge:

    I click on Merge Selected and BAM!!! I get this error every time:

    There is no clue as to what the "unresolved conflicts" or "skipped items" are. Why am I getting this error, and what should I do to merge the changes in A3 into A2 ??? Can someone please help ? All answers will be appreciated. Thanks ...

    I have been following the official Intellij IDEA documentation below:

    Please note that:

    • Currently I am using Subversion, not Git.

    • The directory structure of my local working copies is not exactly identical to that of the SVN repos. Could this be the cause of the error ?

    THE ANSWER ...

    Thanks to Peter Parker and especially Yoav Aharoni for their valuable feedback. As Yoav correctly pointed out, it was indeed the manner in which the branch locations folder was specified. It needs to be the folder containing the branches, not the branch folders themselves: And as Peter rightly said, checking "Include merged revisions" shows the merged history. I am now able to merge from within the IDE itself, and view the merged history in TortoiseSVN. NO command line! YAY!!!

    However, one last problem is that I am unable to view the merged history in Android Studio (Intellij IDEA) as described in Viewing Merge Sources. Does anyone know how to achieve this in Android Studio?

    解决方案

    Phew, haven't used SVN in a while... :)

    But from what I can remember Branch locations should be the folder containing your branches folders (and not each individual branch folder).

    You see, typically a SVN repo follows a standard naming convention and folder structure:

    trunk/
    branches/
      Feature_A2/
      Feature_A3/
    tags/
      v1.01/
      v1.02/
    
    and so on...
    

    trunk is where the main development takes place, and branches are for features, long-term or risky projects, or for different stages (such as QA and pre-prod).

    So, as far as I remember, Android Studio expects you to set Branch locations to branches folder. In your case I think it should be http://192.168.0.64/svn/.../Android/Feature.

    Also, your trunk is not Feature_A2 - Feature_A2 is just another branch.
    Although I can't see the content, I think http://192.168.0.64/svn/.../Android/Development might be your trunk.

    Which shouldn't bother you much, since you don't have to merge to your trunk, you can also merge between branches (e.g. merge Feature_A3 into Feature_A2).

    So, to recap:

    1. Although not mandatory, I recommend renaming your folders to match the conventions (you can easily do it by right clicking in Tortoise SVN, but only AFTER all teammates commit, otherwise merge will be a HELL for them).
    2. Try setting Branch locations to http://192.168.0.64/svn/.../Android/Feature
    3. And Trunk to http://192.168.0.64/svn/.../Android/Development (only if it indeed contains sources, similar to Feature_A2/3)
    4. Consider "tagging" your releases in a tags folder (it's pretty much just copying the trunk/branch folder to tags, but you have a command for that).

      If you do so, you can also add tags folder to Branch locations, that way you'll be able to compare your current source with any previous release (which is handy).

    P.S: "unresolved conflicts" error can also mean you have unresolved conflicts (duh :)). Conflicts are are usually created when both you and a teammate change the same lines in file (or if he deletes a file you changed) and you update to get his changes.

    SVN won't let you merge until you manually resolve these conflicts/changes.

    You can find conflicts in the Version Control tab at the bottom, they'll be mark in red.
    (But I don't think that was the problem in your case)


    Let me know if that works for you!

    这篇关于Android Studio - 无法从 SVN 分支合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆