fetch: make test reproducible, tiny code cleanup
authorBryan O'Sullivan <bos@serpentine.com>
Wed, 05 Mar 2008 09:20:57 -0800
changeset 6207 03b13d853dc6
parent 6206 0b6f12495276
child 6208 c88b9e597588
fetch: make test reproducible, tiny code cleanup
hgext/fetch.py
tests/test-fetch
tests/test-fetch.out
--- a/hgext/fetch.py	Wed Mar 05 09:10:45 2008 -0800
+++ b/hgext/fetch.py	Wed Mar 05 09:20:57 2008 -0800
@@ -79,10 +79,12 @@
         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)
 
--- a/tests/test-fetch	Wed Mar 05 09:10:45 2008 -0800
+++ b/tests/test-fetch	Wed Mar 05 09:20:57 2008 -0800
@@ -24,6 +24,10 @@
 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 @@
 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
--- a/tests/test-fetch.out	Wed Mar 05 09:10:45 2008 -0800
+++ b/tests/test-fetch.out	Wed Mar 05 09:20:57 2008 -0800
@@ -70,4 +70,4 @@
 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