Commits

Pierre-Yves David  committed 1270993

A repo with publish=True as every thing frozen

We still don't handle case where is set to True on a repo with existing
changeset.

  • Participants
  • Parent commits 5faee63

Comments (0)

Files changed (2)

     'debugmelt':  (cmdmelt,   [], _('<revset>')),
     }
 
+# hooks
+##########################
+def autofreeze(ui, repo, hooktype, node, *args, **kwargs):
+    if repo.ui.configbool('liquid', 'publish', True):
+        repo.freeze(noderange(repo, ['%s:%s' % (repo[node].rev(), len(repo)-1)]))
+
+
 # liquid repo class
 ####################
 
 def reposetup(ui, repo):
     if not repo.local():
         return
+    ui.setconfig("hooks", "changegroup.autofreeze", autofreeze)
+    ui.setconfig("hooks", "commit.autofreeze", autofreeze)
 
     opush = repo.push
     opull = repo.pull

File tests/test-liquidhg.t

   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     merge
   
+commit in beta should be frozen
+  $ cd ../beta
+  $ hg up
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ mkcommit goigoi
+  $ hg log -r 'frozenheads()'
+  changeset:   8:0333f0620097
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add goigoi
+  
+pushing back to alpha should freeze (dup) check the table
+  $ hg push ../alpha
+  pushing to ../alpha
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ cd ../alpha
+  $ hg log -r 'frozenheads()'
+  changeset:   8:0333f0620097
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add goigoi
+  
+liquid commit of alpha should be freezed on pull by beta
+  $ hg up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ mkcommit blublu
+  $ cd ../beta
+  $ hg pull ../alpha -u
+  pulling from ../alpha
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 3 changes to 3 files
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -r 'frozenheads()'
+  changeset:   9:30f983519553
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add blublu
+  
+and transmitted as freeze (dup) check the table
+  $ hg push ../alpha
+  pushing to ../alpha
+  searching for changes
+  no changes found
+  $ cd ../beta
+  $ hg log -r 'frozenheads()'
+  changeset:   9:30f983519553
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add blublu
+