Show More
@@ -1316,9 +1316,9 b' def pullrebase(orig, ui, repo, *args, **' | |||
|
1316 | 1316 | ui.debug('--update and --rebase are not compatible, ignoring ' |
|
1317 | 1317 | 'the update flag\n') |
|
1318 | 1318 | |
|
1319 | ui.debug('before rebase: ensure working dir is clean\n') | |
|
1320 | 1319 | cmdutil.checkunfinished(repo) |
|
1321 |
cmdutil.bailifchanged(repo |
|
|
1320 | cmdutil.bailifchanged(repo, hint=_('cannot pull with rebase: ' | |
|
1321 | 'please commit or shelve your changes first')) | |
|
1322 | 1322 | |
|
1323 | 1323 | revsprepull = len(repo) |
|
1324 | 1324 | origpostincoming = commands.postincoming |
@@ -355,15 +355,23 b' def findrepo(p):' | |||
|
355 | 355 | |
|
356 | 356 | return p |
|
357 | 357 | |
|
358 | def bailifchanged(repo, merge=True): | |
|
358 | def bailifchanged(repo, merge=True, hint=None): | |
|
359 | """ enforce the precondition that working directory must be clean. | |
|
360 | ||
|
361 | 'merge' can be set to false if a pending uncommitted merge should be | |
|
362 | ignored (such as when 'update --check' runs). | |
|
363 | ||
|
364 | 'hint' is the usual hint given to Abort exception. | |
|
365 | """ | |
|
366 | ||
|
359 | 367 | if merge and repo.dirstate.p2() != nullid: |
|
360 | raise error.Abort(_('outstanding uncommitted merge')) | |
|
368 | raise error.Abort(_('outstanding uncommitted merge'), hint=hint) | |
|
361 | 369 | modified, added, removed, deleted = repo.status()[:4] |
|
362 | 370 | if modified or added or removed or deleted: |
|
363 | raise error.Abort(_('uncommitted changes')) | |
|
371 | raise error.Abort(_('uncommitted changes'), hint=hint) | |
|
364 | 372 | ctx = repo[None] |
|
365 | 373 | for s in sorted(ctx.substate): |
|
366 | ctx.sub(s).bailifchanged() | |
|
374 | ctx.sub(s).bailifchanged(hint=hint) | |
|
367 | 375 | |
|
368 | 376 | def logmessage(ui, opts): |
|
369 | 377 | """ get the log message according to -m and -l option """ |
@@ -464,12 +464,12 b' class abstractsubrepo(object):' | |||
|
464 | 464 | return _("uncommitted changes in subrepository '%s'" |
|
465 | 465 | ) % subrelpath(self) |
|
466 | 466 | |
|
467 | def bailifchanged(self, ignoreupdate=False): | |
|
467 | def bailifchanged(self, ignoreupdate=False, hint=None): | |
|
468 | 468 | """raise Abort if subrepository is ``dirty()`` |
|
469 | 469 | """ |
|
470 | 470 | dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate) |
|
471 | 471 | if dirtyreason: |
|
472 | raise error.Abort(dirtyreason) | |
|
472 | raise error.Abort(dirtyreason, hint=hint) | |
|
473 | 473 | |
|
474 | 474 | def basestate(self): |
|
475 | 475 | """current working directory base state, disregarding .hgsubstate |
@@ -78,6 +78,7 b' Abort pull early if working dir is not c' | |||
|
78 | 78 | $ echo L1-mod > L1 |
|
79 | 79 | $ hg pull --rebase |
|
80 | 80 | abort: uncommitted changes |
|
81 | (cannot pull with rebase: please commit or shelve your changes first) | |
|
81 | 82 | [255] |
|
82 | 83 | $ hg update --clean --quiet |
|
83 | 84 | |
@@ -95,6 +96,41 b' Abort pull early if another operation (h' | |||
|
95 | 96 | [255] |
|
96 | 97 | $ hg histedit --abort --quiet |
|
97 | 98 | |
|
99 | Abort pull early with pending uncommitted merge: | |
|
100 | ||
|
101 | $ cd .. | |
|
102 | $ hg clone --noupdate c d | |
|
103 | $ cd d | |
|
104 | $ hg tglog | |
|
105 | o 1: 'C2' | |
|
106 | | | |
|
107 | o 0: 'C1' | |
|
108 | ||
|
109 | $ hg update --quiet 0 | |
|
110 | $ echo M1 > M1 | |
|
111 | $ hg commit --quiet -Am M1 | |
|
112 | $ hg update --quiet 1 | |
|
113 | $ hg merge 2 | |
|
114 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
115 | (branch merge, don't forget to commit) | |
|
116 | $ hg pull --rebase | |
|
117 | abort: outstanding uncommitted merge | |
|
118 | (cannot pull with rebase: please commit or shelve your changes first) | |
|
119 | [255] | |
|
120 | $ hg update --clean --quiet | |
|
121 | ||
|
122 | Abort pull early with unclean subrepo: | |
|
123 | $ echo s = s > .hgsub | |
|
124 | $ hg add .hgsub | |
|
125 | $ hg init s | |
|
126 | $ hg commit -m "generated a subrepo" | |
|
127 | $ echo a > s/a | |
|
128 | $ hg -R s add s/a | |
|
129 | $ hg pull --rebase | |
|
130 | abort: uncommitted changes in subrepository 's' | |
|
131 | (cannot pull with rebase: please commit or shelve your changes first) | |
|
132 | [255] | |
|
133 | ||
|
98 | 134 | Invoke pull --rebase and nothing to rebase: |
|
99 | 135 | |
|
100 | 136 | $ cd ../c |
General Comments 0
You need to be logged in to leave comments.
Login now