##// END OF EJS Templates
issue 622: pull/unbundle -u updates to default branch if repo was empty
Bryan O'Sullivan -
r4891:2d545b98 default
parent child Browse files
Show More
@@ -2025,11 +2025,13 b' def paths(ui, repo, search=None):'
2025 for name, path in ui.configitems("paths"):
2025 for name, path in ui.configitems("paths"):
2026 ui.write("%s = %s\n" % (name, path))
2026 ui.write("%s = %s\n" % (name, path))
2027
2027
2028 def postincoming(ui, repo, modheads, optupdate):
2028 def postincoming(ui, repo, modheads, optupdate, wasempty):
2029 if modheads == 0:
2029 if modheads == 0:
2030 return
2030 return
2031 if optupdate:
2031 if optupdate:
2032 if modheads == 1:
2032 if wasempty:
2033 return hg.update(repo, repo.lookup('default'))
2034 elif modheads == 1:
2033 return hg.update(repo, repo.changelog.tip()) # update
2035 return hg.update(repo, repo.changelog.tip()) # update
2034 else:
2036 else:
2035 ui.status(_("not updating, since new heads added\n"))
2037 ui.status(_("not updating, since new heads added\n"))
@@ -2091,8 +2093,9 b' def pull(ui, repo, source="default", **o'
2091 error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
2093 error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
2092 raise util.Abort(error)
2094 raise util.Abort(error)
2093
2095
2096 wasempty = repo.changelog.count() == 0
2094 modheads = repo.pull(other, heads=revs, force=opts['force'])
2097 modheads = repo.pull(other, heads=revs, force=opts['force'])
2095 return postincoming(ui, repo, modheads, opts['update'])
2098 return postincoming(ui, repo, modheads, opts['update'], wasempty)
2096
2099
2097 def push(ui, repo, dest=None, **opts):
2100 def push(ui, repo, dest=None, **opts):
2098 """push changes to the specified destination
2101 """push changes to the specified destination
@@ -2656,6 +2659,7 b' def unbundle(ui, repo, fname1, *fnames, '
2656 """
2659 """
2657 fnames = (fname1,) + fnames
2660 fnames = (fname1,) + fnames
2658 result = None
2661 result = None
2662 wasempty = repo.changelog.count() == 0
2659 for fname in fnames:
2663 for fname in fnames:
2660 if os.path.exists(fname):
2664 if os.path.exists(fname):
2661 f = open(fname, "rb")
2665 f = open(fname, "rb")
@@ -2664,7 +2668,7 b' def unbundle(ui, repo, fname1, *fnames, '
2664 gen = changegroup.readbundle(f, fname)
2668 gen = changegroup.readbundle(f, fname)
2665 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
2669 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
2666
2670
2667 return postincoming(ui, repo, modheads, opts['update'])
2671 return postincoming(ui, repo, modheads, opts['update'], wasempty)
2668
2672
2669 def update(ui, repo, node=None, rev=None, clean=False, date=None):
2673 def update(ui, repo, node=None, rev=None, clean=False, date=None):
2670 """update working directory
2674 """update working directory
@@ -18,3 +18,9 b' hg co'
18 cat foo
18 cat foo
19 hg manifest --debug
19 hg manifest --debug
20 hg pull
20 hg pull
21
22 echo % issue 622
23 cd ..
24 hg init empty
25 cd empty
26 hg pull -u ../test
@@ -21,3 +21,11 b' 2ed2a3912a0b24502043eae84ee4b279c18b90dd'
21 pulling from http://localhost:20059/
21 pulling from http://localhost:20059/
22 searching for changes
22 searching for changes
23 no changes found
23 no changes found
24 % issue 622
25 pulling from ../test
26 requesting all changes
27 adding changesets
28 adding manifests
29 adding file changes
30 added 1 changesets with 1 changes to 1 files
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now