diff --git a/doc/Makefile b/doc/Makefile --- a/doc/Makefile +++ b/doc/Makefile @@ -24,7 +24,7 @@ hg.1.gendoc.txt: $(GENDOC) mv $@.tmp $@ %: %.txt common.txt - $(PYTHON) runrst manpage --halt warning \ + $(PYTHON) runrst hgmanpage --halt warning \ --strip-elements-with-class htmlonly $*.txt $* %.html: %.txt common.txt diff --git a/doc/manpage.py b/doc/hgmanpage.py rename from doc/manpage.py rename to doc/hgmanpage.py --- a/doc/manpage.py +++ b/doc/hgmanpage.py @@ -303,7 +303,7 @@ class Translator(nodes.NodeVisitor): def __init__(self, style): self._style = style - if node.has_key('start'): + if 'start' in node: self._cnt = node['start'] - 1 else: self._cnt = 0 @@ -345,7 +345,7 @@ class Translator(nodes.NodeVisitor): def __repr__(self): return 'enum_style-%s' % list(self._style) - if node.has_key('enumtype'): + if 'enumtype' in node: self._list_char.append(enum_char(node['enumtype'])) else: self._list_char.append(enum_char('bullet')) diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py --- a/hgext/bookmarks.py +++ b/hgext/bookmarks.py @@ -218,8 +218,8 @@ def reposetup(ui, repo): '''Parse .hg/bookmarks file and return a dictionary Bookmarks are stored as {HASH}\\s{NAME}\\n (localtags format) values - in the .hg/bookmarks file. They are read returned as a dictionary - with name => hash values. + in the .hg/bookmarks file. + Read the file and return a (name=>nodeid) dictionary ''' try: bookmarks = {} diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2418,6 +2418,18 @@ def strip(ui, repo, rev, **opts): elif rev not in (cl.ancestor(p[0], rev), cl.ancestor(p[1], rev)): update = False + q = repo.mq + if q.applied: + if rev == cl.ancestor(repo.lookup('qtip'), rev): + q.applied_dirty = True + start = 0 + end = len(q.applied) + applied_list = [i.node for i in q.applied] + if rev in applied_list: + start = applied_list.index(rev) + del q.applied[start:end] + q.save_dirty() + repo.mq.strip(repo, rev, backup=backup, update=update, force=opts['force']) return 0 diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -246,6 +246,15 @@ class transplanter(object): m = match.exact(repo.root, '', files) n = repo.commit(message, user, date, extra=extra, match=m) + if not n: + # Crash here to prevent an unclear crash later, in + # transplants.write(). This can happen if patch.patch() + # does nothing but claims success or if repo.status() fails + # to report changes done by patch.patch(). These both + # appear to be bugs in other parts of Mercurial, but dying + # here, as soon as we can detect the problem, is preferable + # to silently dropping changesets on the floor. + raise RuntimeError('nothing committed after transplant') if not merge: self.transplants.set(n, node) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -549,8 +549,6 @@ def bundle(ui, repo, fname, dest=None, * Returns 0 on success, 1 if no changes found. """ revs = opts.get('rev') or None - if revs: - revs = [repo.lookup(rev) for rev in revs] if opts.get('all'): base = ['null'] else: @@ -567,8 +565,9 @@ def bundle(ui, repo, fname, dest=None, * for n in base: has.update(repo.changelog.reachable(n)) if revs: - visit = list(revs) - has.difference_update(revs) + revs = [repo.lookup(rev) for rev in revs] + visit = revs[:] + has.difference_update(visit) else: visit = repo.changelog.heads() seen = {} @@ -588,6 +587,8 @@ def bundle(ui, repo, fname, dest=None, * dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), dest) revs, checkout = hg.addbranchrevs(repo, other, branches, revs) + if revs: + revs = [repo.lookup(rev) for rev in revs] o = discovery.findoutgoing(repo, other, force=opts.get('force')) if not o: diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -42,7 +42,7 @@ class localrepository(repo.repository): if not os.path.isdir(self.path): if create: if not os.path.exists(path): - os.mkdir(path) + util.makedirs(path) os.mkdir(self.path) requirements = ["revlogv1"] if self.ui.configbool('format', 'usestore', True): diff --git a/tests/test-init b/tests/test-init --- a/tests/test-init +++ b/tests/test-init @@ -84,3 +84,6 @@ for i in bundle file hg http https old-h test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed" done +echo "# creating 'local/sub/repo'" +hg init local/sub/repo +checknewrepo local/sub/repo diff --git a/tests/test-init.out b/tests/test-init.out --- a/tests/test-init.out +++ b/tests/test-init.out @@ -73,3 +73,9 @@ ok ok # hg init "with space" ok +# creating 'local/sub/repo' +store created +00changelog.i created +revlogv1 +store +fncache diff --git a/tests/test-mq-strip b/tests/test-mq-strip --- a/tests/test-mq-strip +++ b/tests/test-mq-strip @@ -53,3 +53,19 @@ hg parents hg strip 4 2>&1 | hidebackup echo % after strip of merge parent hg parents + +#strip of applied mq should cleanup status file +hg up -C 3 +echo fooagain >> bar +hg ci -mf +hg qimport -r tip:2 +echo % applied patches before strip +hg qapplied +echo % stripping revision in queue +hg strip 3 | hidebackup +echo % applied patches after stripping rev in queue +hg qapplied +echo % stripping ancestor of queue +hg strip 1 | hidebackup +echo % applied patches after stripping ancestor of queue +hg qapplied diff --git a/tests/test-mq-strip.out b/tests/test-mq-strip.out --- a/tests/test-mq-strip.out +++ b/tests/test-mq-strip.out @@ -165,3 +165,17 @@ user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: b +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +% applied patches before strip +2.diff +3.diff +4.diff +% stripping revision in queue +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +saved backup bundle to +% applied patches after stripping rev in queue +2.diff +% stripping ancestor of queue +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +saved backup bundle to +% applied patches after stripping ancestor of queue diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -400,15 +400,13 @@ 2 bar qtip tip popping bar now at: foo changeset: 0:cb9a9f314b8b -mq status file refers to unknown node tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: a -mq status file refers to unknown node default 0:cb9a9f314b8b -abort: trying to pop unknown node +no patches applied new file diff --git a/new b/new