##// END OF EJS Templates
document and fix findincoming...
Benoit Boissinot -
r2339:11422943 default
parent child Browse files
Show More
@@ -0,0 +1,49 b''
1 #!/bin/sh
2 #
3 # A B
4 #
5 # 3 4 3
6 # |\/| |\
7 # |/\| | \
8 # 1 2 1 2
9 # \ / \ /
10 # 0 0
11 #
12 # if the result of the merge of 1 and 2
13 # is the same in 3 and 4, no new manifest
14 # will be created and the manifest group
15 # will be empty during the pull
16 #
17 # (plus we test a failure where outgoing
18 # wrongly reported the number of csets)
19 #
20
21 hg init a
22 cd a
23 touch init
24 hg ci -A -m 0 -d "1000000 0"
25 touch x y
26 hg ci -A -m 1 -d "1000000 0"
27 hg update 0
28 touch x y
29 hg ci -A -m 2 -d "1000000 0"
30 hg merge 1
31 hg ci -A -m m1 -d "1000000 0"
32 #hg log
33 #hg debugindex .hg/00manifest.i
34 hg update -C 1
35 hg merge 2
36 hg ci -A -m m2 -d "1000000 0"
37 #hg log
38 #hg debugindex .hg/00manifest.i
39
40 cd ..
41 hg clone -r 3 a b
42 hg clone -r 4 a c
43 hg -R a outgoing b
44 hg -R a outgoing c
45 hg -R b outgoing c
46 hg -R c outgoing b
47
48 hg -R b pull a
49 hg -R c pull a
@@ -0,0 +1,72 b''
1 adding init
2 adding x
3 adding y
4 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
5 adding x
6 adding y
7 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
8 (branch merge, don't forget to commit)
9 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 (branch merge, don't forget to commit)
12 requesting all changes
13 adding changesets
14 adding manifests
15 adding file changes
16 added 4 changesets with 3 changes to 3 files
17 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 requesting all changes
19 adding changesets
20 adding manifests
21 adding file changes
22 added 4 changesets with 3 changes to 3 files
23 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 searching for changes
25 changeset: 4:fdb3c546e859
26 tag: tip
27 parent: 1:1f703b3fcbc6
28 parent: 2:de997049e034
29 user: test
30 date: Mon Jan 12 13:46:40 1970 +0000
31 summary: m2
32
33 searching for changes
34 changeset: 3:f40f830c0024
35 parent: 2:de997049e034
36 parent: 1:1f703b3fcbc6
37 user: test
38 date: Mon Jan 12 13:46:40 1970 +0000
39 summary: m1
40
41 searching for changes
42 changeset: 3:f40f830c0024
43 tag: tip
44 parent: 2:de997049e034
45 parent: 1:1f703b3fcbc6
46 user: test
47 date: Mon Jan 12 13:46:40 1970 +0000
48 summary: m1
49
50 searching for changes
51 changeset: 3:fdb3c546e859
52 tag: tip
53 parent: 1:1f703b3fcbc6
54 parent: 2:de997049e034
55 user: test
56 date: Mon Jan 12 13:46:40 1970 +0000
57 summary: m2
58
59 pulling from a
60 searching for changes
61 adding changesets
62 adding manifests
63 adding file changes
64 added 1 changesets with 0 changes to 0 files (+1 heads)
65 (run 'hg heads' to see heads, 'hg merge' to merge)
66 pulling from a
67 searching for changes
68 adding changesets
69 adding manifests
70 adding file changes
71 added 1 changesets with 0 changes to 0 files (+1 heads)
72 (run 'hg heads' to see heads, 'hg merge' to merge)
@@ -899,6 +899,21 b' class localrepository(object):'
899 899 return r
900 900
901 901 def findincoming(self, remote, base=None, heads=None, force=False):
902 """Return list of roots of the subsets of missing nodes from remote
903
904 If base dict is specified, assume that these nodes and their parents
905 exist on the remote side and that no child of a node of base exists
906 in both remote and self.
907 Furthermore base will be updated to include the nodes that exists
908 in self and remote but no children exists in self and remote.
909 If a list of heads is specified, return only nodes which are heads
910 or ancestors of these heads.
911
912 All the ancestors of base are in self and in remote.
913 All the descendants of the list returned are missing in self.
914 (and so we know that the rest of the nodes are missing in remote, see
915 outgoing)
916 """
902 917 m = self.changelog.nodemap
903 918 search = []
904 919 fetch = {}
@@ -911,6 +926,7 b' class localrepository(object):'
911 926 heads = remote.heads()
912 927
913 928 if self.changelog.tip() == nullid:
929 base[nullid] = 1
914 930 if heads != [nullid]:
915 931 return [nullid]
916 932 return []
@@ -929,7 +945,7 b' class localrepository(object):'
929 945 if not unknown:
930 946 return []
931 947
932 rep = {}
948 req = dict.fromkeys(unknown)
933 949 reqcnt = 0
934 950
935 951 # search through remote branches
@@ -946,12 +962,12 b' class localrepository(object):'
946 962
947 963 self.ui.debug(_("examining %s:%s\n")
948 964 % (short(n[0]), short(n[1])))
949 if n[0] == nullid:
950 break
951 if n in seenbranch:
965 if n[0] == nullid: # found the end of the branch
966 pass
967 elif n in seenbranch:
952 968 self.ui.debug(_("branch already found\n"))
953 969 continue
954 if n[1] and n[1] in m: # do we know the base?
970 elif n[1] and n[1] in m: # do we know the base?
955 971 self.ui.debug(_("found incomplete branch %s:%s\n")
956 972 % (short(n[0]), short(n[1])))
957 973 search.append(n) # schedule branch range for scanning
@@ -962,14 +978,14 b' class localrepository(object):'
962 978 self.ui.debug(_("found new changeset %s\n") %
963 979 short(n[1]))
964 980 fetch[n[1]] = 1 # earliest unknown
965 base[n[2]] = 1 # latest known
966 continue
981 for p in n[2:4]:
982 if p in m:
983 base[p] = 1 # latest known
967 984
968 for a in n[2:4]:
969 if a not in rep:
970 r.append(a)
971 rep[a] = 1
972
985 for p in n[2:4]:
986 if p not in req and p not in m:
987 r.append(p)
988 req[p] = 1
973 989 seen[n[0]] = 1
974 990
975 991 if r:
@@ -980,12 +996,7 b' class localrepository(object):'
980 996 for b in remote.branches(r[p:p+10]):
981 997 self.ui.debug(_("received %s:%s\n") %
982 998 (short(b[0]), short(b[1])))
983 if b[0] in m:
984 self.ui.debug(_("found base node %s\n")
985 % short(b[0]))
986 base[b[0]] = 1
987 elif b[0] not in seen:
988 unknown.append(b)
999 unknown.append(b)
989 1000
990 1001 # do binary search on the branches we found
991 1002 while search:
General Comments 0
You need to be logged in to leave comments. Login now