Want more features on Pastebin? Sign Up, it's FREE!
Guest

Pushing from a partial clone to the original Mercurial repo

By: brandizzi on Mar 27th, 2013  |  syntax: Bash  |  size: 0.79 KB  |  views: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/env sh
  2. # Create some files
  3. mkdir repo1
  4. cd repo1
  5. mkdir -p d1 d2 d3
  6. touch d1/f{1,2}
  7. echo abc > d2/sometext
  8. echo 123 > d3/somenumbers
  9.  
  10. # Make it a mercurial repository
  11. hg init
  12. hg add
  13. hg com -m "Created"
  14.  
  15. # Converting/importing/partially cloning repo1
  16. cd ..
  17. cat > f <<EOF
  18. exclude *
  19. include d1
  20. EOF
  21. hg convert --filemap fileset repo1/ repo2
  22. cd repo2
  23. hg update
  24.  
  25. # Making updates on converted repository
  26. echo "some content on d1/f1" > d1/f1
  27. hg com -m "Updated d1/f1"
  28.  
  29. # Pushing from repo2 to repo1
  30. hg push ../repo1 -f # Note the -f flag
  31. cd ../repo1
  32. echo "HEADS ON repo1 AFTER FORCED PUSH FROM repo2"
  33. hg heads
  34.  
  35. # Merging updates from repo2 into repo1
  36. hg merge
  37. hg com -m merging
  38. echo "HEADS ON repo1 AFTER MERGE OF PUSH FROM repo2"
  39. hg heads
  40. echo "GRAPHIC LOG"
  41. hg glog
clone this paste RAW Paste Data