##// END OF EJS Templates
fetch: use cmdutil.bailifchanged()...
Martin von Zweigbergk -
r22676:a014fdc9 default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8 '''pull, update and merge in one command (DEPRECATED)'''
8 '''pull, update and merge in one command (DEPRECATED)'''
9
9
10 from mercurial.i18n import _
10 from mercurial.i18n import _
11 from mercurial.node import nullid, short
11 from mercurial.node import short
12 from mercurial import commands, cmdutil, hg, util, error
12 from mercurial import commands, cmdutil, hg, util, error
13 from mercurial.lock import release
13 from mercurial.lock import release
14
14
@@ -48,7 +48,7 b" def fetch(ui, repo, source='default', **"
48 if date:
48 if date:
49 opts['date'] = util.parsedate(date)
49 opts['date'] = util.parsedate(date)
50
50
51 parent, p2 = repo.dirstate.parents()
51 parent, _p2 = repo.dirstate.parents()
52 branch = repo.dirstate.branch()
52 branch = repo.dirstate.branch()
53 try:
53 try:
54 branchnode = repo.branchtip(branch)
54 branchnode = repo.branchtip(branch)
@@ -58,19 +58,13 b" def fetch(ui, repo, source='default', **"
58 raise util.Abort(_('working dir not at branch tip '
58 raise util.Abort(_('working dir not at branch tip '
59 '(use "hg update" to check out branch tip)'))
59 '(use "hg update" to check out branch tip)'))
60
60
61 if p2 != nullid:
62 raise util.Abort(_('outstanding uncommitted merge'))
63
64 wlock = lock = None
61 wlock = lock = None
65 try:
62 try:
66 wlock = repo.wlock()
63 wlock = repo.wlock()
67 lock = repo.lock()
64 lock = repo.lock()
68 mod, add, rem, del_ = repo.status()[:4]
69
65
70 if mod or add or rem:
66 cmdutil.bailifchanged(repo)
71 raise util.Abort(_('outstanding uncommitted changes'))
67
72 if del_:
73 raise util.Abort(_('working directory is missing some files'))
74 bheads = repo.branchheads(branch)
68 bheads = repo.branchheads(branch)
75 bheads = [head for head in bheads if len(repo[head].children()) == 0]
69 bheads = [head for head in bheads if len(repo[head].children()) == 0]
76 if len(bheads) > 1:
70 if len(bheads) > 1:
@@ -150,7 +150,7 b' should merge f into g'
150 should abort, because i is modified
150 should abort, because i is modified
151
151
152 $ hg --cwd i fetch ../h
152 $ hg --cwd i fetch ../h
153 abort: working directory is missing some files
153 abort: uncommitted changes
154 [255]
154 [255]
155
155
156 test fetch with named branches
156 test fetch with named branches
General Comments 0
You need to be logged in to leave comments. Login now