Managing trunk and feature branches: local delete,

2019-07-31 07:54发布

I am using svn with a feature branch scheme. Whenever I try to merge trunk to a branch, I got the problem "local delete, incoming delete upon merge". It does not make sense to me. What I did to reproduce the error: 1) create a branch with "svn copy ^/blabla/trunk ^/blabla/branches/test-merge" 2) add a new file to trunk "touch t.c ; svn add t.c ; svn commit" 3) merge to trunk to branch "svn merge ^/blabla/trunk ^/blabla/branches/test-merge" The output is:

--- Merging differences between repository URLs into '.':
 C t.c
Summary of conflicts:
 Tree conflicts: 1

I am using version "1.6.17 (r1128011)"

Resolving the conflict manually (with svn accept) does not help. The new file does not appear in the branch and a new merge results in the same conflict.

What am I doing wrong?

1条回答
ら.Afraid
2楼-- · 2019-07-31 08:47

Extraction from svn help merge

4 This form is called a '2-URL merge':

  svn merge SOURCE1[@N] SOURCE2[@M] [TARGET_WCPATH]

Two source URLs are specified, together with two revisions N and M. The two sources are compared at the specified revisions, and the difference is applied to TARGET_WCPATH, which is a path to a working copy of another branch.

I'll skip some preliminary steps before merge and will use Win-style paths in some places (no bash here, sorry) and slightly change workflow (branch will be non-empty)

z:\>dir /B
svn
localws

z:\>dir localws /B /S
z:\localws\mtree
...
z:\localws\mtree\branches
z:\localws\mtree\trunk

z:\>svn ls -v -R file:///Z:/svn/mtree
      3 Badger                окт 13 21:30 ./
      3 Badger                окт 13 21:30 branches/
      2 Badger                окт 13 21:29 trunk/

(repo and WC prepared, but still empty)


Files created and commited to trunk

z:\>dir /B z:\localws\mtree\trunk
1.txt
2.txt

z:\>svn ls -v -R file:///Z:/svn/mtree
      4 Badger                окт 13 21:48 ./
      3 Badger                окт 13 21:30 branches/
      4 Badger                окт 13 21:48 trunk/
      4 Badger              9 окт 13 21:48 trunk/1.txt
      4 Badger              9 окт 13 21:48 trunk/2.txt

Branch initiated

Z:\localws\mtree\trunk>svn copy file:///Z:/svn/mtree/trunk file:///Z:/svn/mtree/branches/test-reintegrate -m "Create test-reintegrate branch"

Committed revision 5.

Test it

Z:\localws\mtree\trunk>svn ls -v -R file:///Z:/svn/mtree
      5 Badger                окт 13 22:17 ./
      5 Badger                окт 13 22:17 branches/
      5 Badger                окт 13 22:17 branches/test-reintegrate/
      4 Badger              9 окт 13 21:48 branches/test-reintegrate/1.txt
      4 Badger              9 окт 13 21:48 branches/test-reintegrate/2.txt
      4 Badger                окт 13 21:48 trunk/
      4 Badger              9 окт 13 21:48 trunk/1.txt
      4 Badger              9 окт 13 21:48 trunk/2.txt

and get updated WC after svn up in Z:\localws\mtree

Z:\localws\mtree>dir /B /S
Z:\localws\mtree\branches
Z:\localws\mtree\trunk
...
Z:\localws\mtree\branches\test-reintegrate\2.txt
Z:\localws\mtree\branches\test-reintegrate\1.txt
Z:\localws\mtree\trunk\1.txt
Z:\localws\mtree\trunk\2.txt

Added new file to trunk, edited file in branch

Z:\localws\mtree>svn log -v -r6:7
------------------------------------------------------------------------
r6 | Badger | 2012-10-13 22:28:04 +0600 (Сб, 13 окт 2012) | 1 line
Changed paths:
   A /mtree/trunk/3.txt

Added new file to trunk
------------------------------------------------------------------------
r7 | Badger | 2012-10-13 22:29:20 +0600 (Сб, 13 окт 2012) | 1 line
Changed paths:
   M /mtree/branches/test-reintegrate/2.txt

Some changes
------------------------------------------------------------------------

Server-side view

Z:\localws\mtree>svn ls -v -R file:///Z:/svn/mtree
      7 Badger                окт 13 22:29 ./
      7 Badger                окт 13 22:29 branches/
      7 Badger                окт 13 22:29 branches/test-reintegrate/
      4 Badger              9 окт 13 21:48 branches/test-reintegrate/1.txt
      7 Badger             17 окт 13 22:29 branches/test-reintegrate/2.txt
      6 Badger                окт 13 22:28 trunk/
      4 Badger              9 окт 13 21:48 trunk/1.txt
      4 Badger              9 окт 13 21:48 trunk/2.txt
      6 Badger              9 окт 13 22:28 trunk/3.txt

Sync branch with trunk - merge changes from trunk to test-reintegrate

Z:\localws\mtree>cd branches

Z:\localws\mtree\branches>cd test-reintegrate
Z:\localws\mtree\branches\test-reintegrate>svn merge file:///Z:/svn/mtree/trunk
--- Merging r5 through r7 into '.':
A    3.txt
--- Recording mergeinfo for merge of r5 through r7 into '.':
 U   .

Check WC state

Z:\localws\mtree\branches\test-reintegrate>dir /B
2.txt
1.txt
3.txt

and commit results

Z:\localws\mtree\branches\test-reintegrate>svn commit -m "Sync of test-reintegrate"
Sending        .
Adding         3.txt

Committed revision 8.

Server-side

Z:\>svn ls -v file:///Z:/svn/mtree/branches/test-reintegrate
      8 Badger                окт 13 22:47 ./
      4 Badger              9 окт 13 21:48 1.txt
      7 Badger             17 окт 13 22:29 2.txt
      8 Badger              9 окт 13 22:47 3.txt

Resume

My changes in comparison to your style (and "win ws fail" result)

  • Full path without ^ shorthand (I got error even on svn copy stage, AFAIK ^ recommended and usable in case of "branch in the root of WC" style, not combined common WC /but I could be wrong/)

  • Using classic form of merge (Single URL)

HTH

查看更多
登录 后发表回答