##// END OF EJS Templates
setparents: drop copies from dropped p2 (issue3843)
Matt Mackall -
r18739:5b717537 2.5.2 stable
parent child Browse files
Show More
@@ -705,14 +705,18 b' class localrepository(object):'
705
705
706 def setparents(self, p1, p2=nullid):
706 def setparents(self, p1, p2=nullid):
707 copies = self.dirstate.setparents(p1, p2)
707 copies = self.dirstate.setparents(p1, p2)
708 pctx = self[p1]
708 if copies:
709 if copies:
709 # Adjust copy records, the dirstate cannot do it, it
710 # Adjust copy records, the dirstate cannot do it, it
710 # requires access to parents manifests. Preserve them
711 # requires access to parents manifests. Preserve them
711 # only for entries added to first parent.
712 # only for entries added to first parent.
712 pctx = self[p1]
713 for f in copies:
713 for f in copies:
714 if f not in pctx and copies[f] in pctx:
714 if f not in pctx and copies[f] in pctx:
715 self.dirstate.copy(copies[f], f)
715 self.dirstate.copy(copies[f], f)
716 if p2 == nullid:
717 for f, s in sorted(self.dirstate.copies().items()):
718 if f not in pctx and s not in pctx:
719 self.dirstate.copy(None, f)
716
720
717 def filectx(self, path, changeid=None, fileid=None):
721 def filectx(self, path, changeid=None, fileid=None):
718 """changeid can be a changeset revision, node, or tag.
722 """changeid can be a changeset revision, node, or tag.
@@ -31,7 +31,7 b' http://mercurial.selenic.com/bts/issue11'
31 b
31 b
32 b: searching for copy revision for a
32 b: searching for copy revision for a
33 b: copy a:b80de5d138758541c5f05265ad144ab9fa86d1db
33 b: copy a:b80de5d138758541c5f05265ad144ab9fa86d1db
34 committed changeset 5:89e8e4be0de296fa3d6dd7825ccc44d7dc0f1f3b
34 committed changeset 5:732aafbecb501a198b3cc9323ad3899ff04ccf95
35
35
36 $ hg verify
36 $ hg verify
37 checking changesets
37 checking changesets
@@ -44,8 +44,8 b' http://mercurial.selenic.com/bts/issue11'
44 # HG changeset patch
44 # HG changeset patch
45 # User test
45 # User test
46 # Date 0 0
46 # Date 0 0
47 # Node ID 89e8e4be0de296fa3d6dd7825ccc44d7dc0f1f3b
47 # Node ID 732aafbecb501a198b3cc9323ad3899ff04ccf95
48 # Parent 7fc86ba705e717a721dbc361bf8c9bc05a18ca2f
48 # Parent 1d1625283f71954f21d14c3d44d0ad3c019c597f
49 5
49 5
50
50
51 diff --git a/b b/b
51 diff --git a/b b/b
@@ -12,20 +12,24 b''
12 $ hg init a
12 $ hg init a
13 $ cd a
13 $ cd a
14
14
15 $ mkdir d
15 $ echo a > a
16 $ echo a > a
16 $ hg ci -Am A
17 $ hg ci -Am A
17 adding a
18 adding a
18
19
19 $ echo b > b
20 $ echo b > d/b
20 $ hg ci -Am B
21 $ hg ci -Am B
21 adding b
22 adding d/b
22
23
23 $ hg mv b b-renamed
24 $ hg mv d d-renamed
25 moving d/b to d-renamed/b
24 $ hg ci -m 'rename B'
26 $ hg ci -m 'rename B'
25
27
26 $ hg up -q -C 1
28 $ hg up -q -C 1
27
29
28 $ hg mv a a-renamed
30 $ hg mv a a-renamed
31 $ echo x > d/x
32 $ hg add d/x
29
33
30 $ hg ci -m 'rename A'
34 $ hg ci -m 'rename A'
31 created new head
35 created new head
@@ -47,6 +51,12 b' Rename is tracked:'
47 diff --git a/a b/a-renamed
51 diff --git a/a b/a-renamed
48 rename from a
52 rename from a
49 rename to a-renamed
53 rename to a-renamed
54 diff --git a/d/x b/d/x
55 new file mode 100644
56 --- /dev/null
57 +++ b/d/x
58 @@ -0,0 +1,1 @@
59 +x
50
60
51 Rebase the revision containing the rename:
61 Rebase the revision containing the rename:
52
62
@@ -70,23 +80,29 b' Rename is not lost:'
70 diff --git a/a b/a-renamed
80 diff --git a/a b/a-renamed
71 rename from a
81 rename from a
72 rename to a-renamed
82 rename to a-renamed
83 diff --git a/d-renamed/x b/d-renamed/x
84 new file mode 100644
85 --- /dev/null
86 +++ b/d-renamed/x
87 @@ -0,0 +1,1 @@
88 +x
73
89
74
90
75 Rebased revision does not contain information about b (issue3739)
91 Rebased revision does not contain information about b (issue3739)
76
92
77 $ hg log -r 3 --debug
93 $ hg log -r 3 --debug
78 changeset: 3:3b905b1064f14ace3ad02353b79dd42d32981655
94 changeset: 3:032a9b75e83bff1dcfb6cbfa4ef50a704bf1b569
79 tag: tip
95 tag: tip
80 phase: draft
96 phase: draft
81 parent: 2:920a371a5635af23a26a011ca346cecd1cfcb942
97 parent: 2:220d0626d185f372d9d8f69d9c73b0811d7725f7
82 parent: -1:0000000000000000000000000000000000000000
98 parent: -1:0000000000000000000000000000000000000000
83 manifest: 3:c4a62b2b64593c8fe0523d4c1ba2e243a8bd4dce
99 manifest: 3:035d66b27a1b06b2d12b46d41a39adb7a200c370
84 user: test
100 user: test
85 date: Thu Jan 01 00:00:00 1970 +0000
101 date: Thu Jan 01 00:00:00 1970 +0000
86 files+: a-renamed
102 files+: a-renamed d-renamed/x
87 files-: a
103 files-: a
88 extra: branch=default
104 extra: branch=default
89 extra: rebase_source=89af05cb38a281f891c6f5581dd027092da29166
105 extra: rebase_source=73a3ee40125d6f0f347082e5831ceccb3f005f8a
90 description:
106 description:
91 rename A
107 rename A
92
108
General Comments 0
You need to be logged in to leave comments. Login now