[PATCH 6 of 8] postincoming: output a warning if the working copy is abandoned
Martin Geisler
mg at lazybytes.net
Wed Jun 1 16:42:52 UTC 2011
# HG changeset patch
# User Martin Geisler <mg at lazybytes.net>
# Date 1306946445 -7200
# Node ID 756c1fbbecb6fe8ef798f8063ee95b738d47f8b7
# Parent 09faf6a64b54632148461ca185c000849c7cb02f
postincoming: output a warning if the working copy is abandoned
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3668,7 +3668,7 @@
else:
ui.write("%s = %s\n" % (name, util.hidepassword(path)))
-def postincoming(ui, repo, modheads, optupdate, checkout):
+def postincoming(ui, repo, modheads, optupdate, checkout, abandoned):
if modheads == 0:
return
if optupdate:
@@ -3677,6 +3677,8 @@
except util.Abort, inst:
ui.warn(_("not updating: %s\n" % str(inst)))
return 0
+ if not abandoned and repo['.'].abandoned():
+ ui.warn(_("working copy has been abandoned\n"))
if modheads > 1:
currentbranchheads = len(repo.branchheads())
if currentbranchheads == modheads:
@@ -3741,6 +3743,7 @@
"so a rev cannot be specified.")
raise util.Abort(err)
+ abandoned = repo.abandoned('.')
modheads = repo.pull(other, heads=revs, force=opts.get('force'),
abandoned=opts.get('abandoned'))
bookmarks.updatefromremote(ui, repo, other)
@@ -3748,8 +3751,8 @@
checkout = str(repo.changelog.rev(other.lookup(checkout)))
repo._subtoppath = source
try:
- ret = postincoming(ui, repo, modheads, opts.get('update'), checkout)
-
+ ret = postincoming(ui, repo, modheads, opts.get('update'), checkout,
+ abandoned)
finally:
del repo._subtoppath
@@ -4975,6 +4978,7 @@
lock = repo.lock()
wc = repo['.']
+ abandoned = wc.abandoned()
try:
for fname in fnames:
f = url.open(ui, fname)
@@ -4984,7 +4988,8 @@
bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch())
finally:
lock.release()
- return postincoming(ui, repo, modheads, opts.get('update'), None)
+ return postincoming(ui, repo, modheads, opts.get('update'), None,
+ abandoned)
@command('^update|up|checkout|co',
[('C', 'clean', None, _('discard uncommitted changes (no backup)')),
diff --git a/tests/test-abandoned.t b/tests/test-abandoned.t
--- a/tests/test-abandoned.t
+++ b/tests/test-abandoned.t
@@ -388,6 +388,7 @@
adding manifests
adding file changes
added 1 changesets with 0 changes to 0 files
+ working copy has been abandoned
(run 'hg update' to get a working copy)
$ hg log --abandoned
2 339976ff5010 abandoned
@@ -402,6 +403,7 @@
adding manifests
adding file changes
added 1 changesets with 0 changes to 0 files
+ working copy has been abandoned
(run 'hg update' to get a working copy)
$ hg log --abandoned
2 339976ff5010 abandoned
More information about the Mercurial-devel
mailing list