Show More
@@ -0,0 +1,17 b'' | |||||
|
1 | mkdir a | |||
|
2 | cd a | |||
|
3 | hg init | |||
|
4 | echo 123 > a | |||
|
5 | hg add a | |||
|
6 | hg commit -t "a" -u a -d "0 0" | |||
|
7 | ||||
|
8 | cd .. | |||
|
9 | mkdir b | |||
|
10 | cd b | |||
|
11 | hg init | |||
|
12 | echo 321 > b | |||
|
13 | hg add b | |||
|
14 | hg commit -t "b" -u b -d "0 0" | |||
|
15 | ||||
|
16 | hg pull ../a | |||
|
17 | hg heads |
@@ -0,0 +1,19 b'' | |||||
|
1 | pulling from ../a | |||
|
2 | searching for changes | |||
|
3 | warning: pulling from an unrelated repository! | |||
|
4 | adding changesets | |||
|
5 | adding manifests | |||
|
6 | adding file revisions | |||
|
7 | modified 1 files, added 1 changesets and 1 new revisions | |||
|
8 | (run 'hg update' to get a working copy) | |||
|
9 | changeset: 1:9a79c33a9db37480e40fbd2a65d62ebd2a3c441c | |||
|
10 | tag: tip | |||
|
11 | user: a | |||
|
12 | date: Thu Jan 1 00:00:00 1970 | |||
|
13 | summary: a | |||
|
14 | ||||
|
15 | changeset: 0:01f8062b2de51c0fa6428c5db1d1b3ea780189df | |||
|
16 | user: b | |||
|
17 | date: Thu Jan 1 00:00:00 1970 | |||
|
18 | summary: b | |||
|
19 |
@@ -852,6 +852,7 b' class localrepository:' | |||||
852 | m = self.changelog.nodemap |
|
852 | m = self.changelog.nodemap | |
853 | search = [] |
|
853 | search = [] | |
854 | fetch = [] |
|
854 | fetch = [] | |
|
855 | base = {} | |||
855 | seen = {} |
|
856 | seen = {} | |
856 | seenbranch = {} |
|
857 | seenbranch = {} | |
857 |
|
858 | |||
@@ -861,6 +862,7 b' class localrepository:' | |||||
861 | return [nullid] |
|
862 | return [nullid] | |
862 |
|
863 | |||
863 | # otherwise, assume we're closer to the tip than the root |
|
864 | # otherwise, assume we're closer to the tip than the root | |
|
865 | # and start by examining the heads | |||
864 | self.ui.status("searching for changes\n") |
|
866 | self.ui.status("searching for changes\n") | |
865 | heads = remote.heads() |
|
867 | heads = remote.heads() | |
866 | unknown = [] |
|
868 | unknown = [] | |
@@ -874,6 +876,10 b' class localrepository:' | |||||
874 | rep = {} |
|
876 | rep = {} | |
875 | reqcnt = 0 |
|
877 | reqcnt = 0 | |
876 |
|
878 | |||
|
879 | # search through remote branches | |||
|
880 | # a 'branch' here is a linear segment of history, with four parts: | |||
|
881 | # head, root, first parent, second parent | |||
|
882 | # (a branch always has two parents (or none) by definition) | |||
877 | unknown = remote.branches(unknown) |
|
883 | unknown = remote.branches(unknown) | |
878 | while unknown: |
|
884 | while unknown: | |
879 | r = [] |
|
885 | r = [] | |
@@ -899,6 +905,7 b' class localrepository:' | |||||
899 | self.ui.debug("found new changeset %s\n" % |
|
905 | self.ui.debug("found new changeset %s\n" % | |
900 | short(n[1])) |
|
906 | short(n[1])) | |
901 | fetch.append(n[1]) # earliest unknown |
|
907 | fetch.append(n[1]) # earliest unknown | |
|
908 | base[n[2]] = 1 # latest known | |||
902 | continue |
|
909 | continue | |
903 |
|
910 | |||
904 | for a in n[2:4]: |
|
911 | for a in n[2:4]: | |
@@ -919,6 +926,7 b' class localrepository:' | |||||
919 | if b[0] not in m and b[0] not in seen: |
|
926 | if b[0] not in m and b[0] not in seen: | |
920 | unknown.append(b) |
|
927 | unknown.append(b) | |
921 |
|
928 | |||
|
929 | # do binary search on the branches we found | |||
922 | while search: |
|
930 | while search: | |
923 | n = search.pop(0) |
|
931 | n = search.pop(0) | |
924 | reqcnt += 1 |
|
932 | reqcnt += 1 | |
@@ -933,6 +941,7 b' class localrepository:' | |||||
933 | self.ui.debug("found new branch changeset %s\n" % |
|
941 | self.ui.debug("found new branch changeset %s\n" % | |
934 | short(p)) |
|
942 | short(p)) | |
935 | fetch.append(p) |
|
943 | fetch.append(p) | |
|
944 | base[i] = 1 | |||
936 | else: |
|
945 | else: | |
937 | self.ui.debug("narrowed branch search to %s:%s\n" |
|
946 | self.ui.debug("narrowed branch search to %s:%s\n" | |
938 | % (short(p), short(i))) |
|
947 | % (short(p), short(i))) | |
@@ -940,11 +949,12 b' class localrepository:' | |||||
940 | break |
|
949 | break | |
941 | p, f = i, f * 2 |
|
950 | p, f = i, f * 2 | |
942 |
|
951 | |||
|
952 | # sanity check our fetch list | |||
943 | for f in fetch: |
|
953 | for f in fetch: | |
944 | if f in m: |
|
954 | if f in m: | |
945 | raise RepoError("already have changeset " + short(f[:4])) |
|
955 | raise RepoError("already have changeset " + short(f[:4])) | |
946 |
|
956 | |||
947 |
if |
|
957 | if base.keys() == [nullid]: | |
948 | self.ui.warn("warning: pulling from an unrelated repository!\n") |
|
958 | self.ui.warn("warning: pulling from an unrelated repository!\n") | |
949 |
|
959 | |||
950 | self.ui.note("adding new changesets starting at " + |
|
960 | self.ui.note("adding new changesets starting at " + |
General Comments 0
You need to be logged in to leave comments.
Login now