Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.py @ 579:ffeb2c3a1966
Actually warn on pulling from an unrelated repository
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Actually warn on pulling from an unrelated repository
add some comments to findincoming
track the base nodes of the fetch set
report if the base set only contains nullid
add a test case
manifest hash: 3fc038a6041b0967a20503f5ec8876efc038841a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCx0yLywK+sNU5EO8RAlK6AJ9J/GKPpYSMzTqmguXPWOISJ+zY5gCghd+j
ClLpn0dKZnB46dh0F8zhuuk=
=emNb
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Sat, 02 Jul 2005 18:25:15 -0800 |
parents | e33c85d2812a |
children | df8a5a0098d4 |
line wrap: on
line diff
--- a/mercurial/hg.py Sat Jul 02 15:38:16 2005 -0800 +++ b/mercurial/hg.py Sat Jul 02 18:25:15 2005 -0800 @@ -852,6 +852,7 @@ m = self.changelog.nodemap search = [] fetch = [] + base = {} seen = {} seenbranch = {} @@ -861,6 +862,7 @@ return [nullid] # otherwise, assume we're closer to the tip than the root + # and start by examining the heads self.ui.status("searching for changes\n") heads = remote.heads() unknown = [] @@ -874,6 +876,10 @@ rep = {} reqcnt = 0 + # search through remote branches + # a 'branch' here is a linear segment of history, with four parts: + # head, root, first parent, second parent + # (a branch always has two parents (or none) by definition) unknown = remote.branches(unknown) while unknown: r = [] @@ -899,6 +905,7 @@ self.ui.debug("found new changeset %s\n" % short(n[1])) fetch.append(n[1]) # earliest unknown + base[n[2]] = 1 # latest known continue for a in n[2:4]: @@ -919,6 +926,7 @@ if b[0] not in m and b[0] not in seen: unknown.append(b) + # do binary search on the branches we found while search: n = search.pop(0) reqcnt += 1 @@ -933,6 +941,7 @@ self.ui.debug("found new branch changeset %s\n" % short(p)) fetch.append(p) + base[i] = 1 else: self.ui.debug("narrowed branch search to %s:%s\n" % (short(p), short(i))) @@ -940,11 +949,12 @@ break p, f = i, f * 2 + # sanity check our fetch list for f in fetch: if f in m: raise RepoError("already have changeset " + short(f[:4])) - if fetch == [nullid]: + if base.keys() == [nullid]: self.ui.warn("warning: pulling from an unrelated repository!\n") self.ui.note("adding new changesets starting at " +