##// END OF EJS Templates
pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho -
r5224:20817af2 default
parent child Browse files
Show More
@@ -2021,12 +2021,12 b' def paths(ui, repo, search=None):'
2021 2021 for name, path in ui.configitems("paths"):
2022 2022 ui.write("%s = %s\n" % (name, path))
2023 2023
2024 def postincoming(ui, repo, modheads, optupdate):
2024 def postincoming(ui, repo, modheads, optupdate, checkout):
2025 2025 if modheads == 0:
2026 2026 return
2027 2027 if optupdate:
2028 if modheads <= 1:
2029 return hg.update(repo, None)
2028 if modheads <= 1 or checkout:
2029 return hg.update(repo, checkout)
2030 2030 else:
2031 2031 ui.status(_("not updating, since new heads added\n"))
2032 2032 if modheads > 1:
@@ -2089,7 +2089,7 b' def pull(ui, repo, source="default", **o'
2089 2089 raise util.Abort(error)
2090 2090
2091 2091 modheads = repo.pull(other, heads=revs, force=opts['force'])
2092 return postincoming(ui, repo, modheads, opts['update'])
2092 return postincoming(ui, repo, modheads, opts['update'], checkout)
2093 2093
2094 2094 def push(ui, repo, dest=None, **opts):
2095 2095 """push changes to the specified destination
@@ -2661,7 +2661,7 b' def unbundle(ui, repo, fname1, *fnames, '
2661 2661 gen = changegroup.readbundle(f, fname)
2662 2662 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
2663 2663
2664 return postincoming(ui, repo, modheads, opts['update'])
2664 return postincoming(ui, repo, modheads, opts['update'], None)
2665 2665
2666 2666 def update(ui, repo, node=None, rev=None, clean=False, date=None):
2667 2667 """update working directory
@@ -51,3 +51,33 b' hg -q pull'
51 51 hg heads
52 52 echo
53 53
54 echo '% pull should not have updated'
55 hg parents -q
56 echo '% going back to the default branch'
57 hg up -C 0
58 hg parents
59 echo '% no new revs, no update'
60 hg pull -qu
61 hg parents -q
62 echo '% rollback'
63 hg rollback
64 hg up -C 0
65 hg parents -q
66 echo '% pull -u takes us back to branch foo'
67 hg pull -qu
68 hg parents
69
70 echo '% rollback'
71 hg rollback
72 hg up -C 0
73 echo '% parents'
74 hg parents -q
75 echo '% heads'
76 hg heads -q
77 echo '% pull -u -r otherrev url#rev updates to rev'
78 hg pull -qur default default
79 echo '% parents'
80 hg parents
81 echo '% heads'
82 hg heads
83
@@ -76,3 +76,55 b' date: Thu Jan 01 00:00:00 1970 +0'
76 76 summary: new head of branch foo
77 77
78 78
79 % pull should not have updated
80 1:cd2a86ecc814
81 % going back to the default branch
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 changeset: 0:1f0dee641bb7
84 user: test
85 date: Thu Jan 01 00:00:00 1970 +0000
86 summary: add a
87
88 % no new revs, no update
89 0:1f0dee641bb7
90 % rollback
91 rolling back last transaction
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 0:1f0dee641bb7
94 % pull -u takes us back to branch foo
95 changeset: 2:faba9097cad4
96 branch: foo
97 tag: tip
98 user: test
99 date: Thu Jan 01 00:00:00 1970 +0000
100 summary: new head of branch foo
101
102 % rollback
103 rolling back last transaction
104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 % parents
106 0:1f0dee641bb7
107 % heads
108 1:cd2a86ecc814
109 % pull -u -r otherrev url#rev updates to rev
110 % parents
111 changeset: 2:faba9097cad4
112 branch: foo
113 user: test
114 date: Thu Jan 01 00:00:00 1970 +0000
115 summary: new head of branch foo
116
117 % heads
118 changeset: 3:4cd725637392
119 tag: tip
120 parent: 0:1f0dee641bb7
121 user: test
122 date: Thu Jan 01 00:00:00 1970 +0000
123 summary: add bar
124
125 changeset: 2:faba9097cad4
126 branch: foo
127 user: test
128 date: Thu Jan 01 00:00:00 1970 +0000
129 summary: new head of branch foo
130
General Comments 0
You need to be logged in to leave comments. Login now