# HG changeset patch # User Bryan O'Sullivan # Date 2008-03-05 17:20:57 # Node ID 03b13d853dc6cba5a458803eea82e9c6751ec162 # Parent 0b6f12495276ea2551bb2cf191da7d4b9313e5be fetch: make test reproducible, tiny code cleanup diff --git a/hgext/fetch.py b/hgext/fetch.py --- a/hgext/fetch.py +++ b/hgext/fetch.py @@ -79,10 +79,12 @@ def fetch(ui, repo, source='default', ** ui.status(_('pulling from %s\n') % util.hidepassword(ui.expandpath(source))) revs = None - if opts['rev'] and not other.local(): - raise util.Abort(_("fetch -r doesn't work for remote repositories yet")) - elif opts['rev']: - revs = [other.lookup(rev) for rev in opts['rev']] + if opts['rev']: + if not other.local(): + raise util.Abort(_("fetch -r doesn't work for remote " + "repositories yet")) + else: + revs = [other.lookup(rev) for rev in opts['rev']] modheads = repo.pull(other, heads=revs) return postincoming(other, modheads) diff --git a/tests/test-fetch b/tests/test-fetch --- a/tests/test-fetch +++ b/tests/test-fetch @@ -24,6 +24,10 @@ hg --cwd c commit -d '3 0' -Amc hg clone c d hg clone c e +# We cannot use the default commit message if fetching from a local +# repo, because the path of the repo will be included in the commit +# message, making every commit appear different. + echo % should merge c into a hg --cwd c fetch -d '4 0' -m 'automated merge' ../a ls c @@ -49,4 +53,4 @@ echo g > g/g hg --cwd g ci -d '6 0' -Amg echo % should merge f into g -hg --cwd g fetch --switch ../f +hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f diff --git a/tests/test-fetch.out b/tests/test-fetch.out --- a/tests/test-fetch.out +++ b/tests/test-fetch.out @@ -70,4 +70,4 @@ added 1 changesets with 1 changes to 1 f 0 files updated, 0 files merged, 0 files removed, 0 files unresolved merging with 3:cc6a3744834d 1 files updated, 0 files merged, 0 files removed, 0 files unresolved -new changeset 4:96d2275e70b4 merges remote changes with local +new changeset 4:55aa4f32ec59 merges remote changes with local